当前位置:网站首页>Processus général de requête pour PostgreSQL
Processus général de requête pour PostgreSQL
2022-07-07 02:21:00 【Happytre001】
Le client passe parpgLe processus approximatif de requête du serveur est le suivant

Un.、 Établir une connexion
Le client doit d'abord se connecterpgServeur,Après avoir établi une connexion avec le clientforkUn sous - processus traite les demandes des clients suivants,Le serveur attend ensuite la connexion du client suivant.
2.、Envoyer la demande
Le client envoie les données demandées àpgServeur,pgDemande de lecture du sous - processus.
- Le client envoie la demande
Comme la ligne de commande,Lire l'entrée de l'utilisateur,Envoyer au serveursrc/bin/psql/mainloop.c
int
MainLoop(FILE *source)
{
...
SendQuery(query_buf->data);
...
}
- Le serveur reçoit la demande
void
PostgresMain(int argc, char *argv[],
const char *dbname,
const char *username)
{
...
for (;;)
{
...
firstchar = ReadCommand(&input_message);
...
}
}
Trois、Analyse
Prenons l'exemple d'une simple requête.Le serveur a reçu une chaîne, Il faut analyser et comprendre ces données pour effectuer .
src/backend/tcop/postgres.c
static void
exec_simple_query(const char *query_string)
{
...
parsetree_list = pg_parse_query(query_string);
...
}
Analyse lexicale et grammaticale , Construire un arbre syntaxique original .
Quatre、Optimisation
static void
exec_simple_query(const char *query_string)
{
...
querytree_list = pg_analyze_and_rewrite(parsetree, query_string,
NULL, 0, NULL);
plantree_list = pg_plan_queries(querytree_list, query_string,
CURSOR_OPT_PARALLEL_OK, NULL);
..
}
Convertit l'Arbre syntaxique Original en un arbre de requête , Et optimiser et réécrire l'arbre de requête , Augmenter la vitesse d'exécution .
Cinq、Mise en œuvre
static void
exec_simple_query(const char *query_string)
{
...
(void) PortalRun(portal,
FETCH_ALL,
true, /* always top level */
true,
receiver,
receiver,
&qc);
...
}
Six、Retour aux résultats
La fonction spécifique est également trouvée pour
边栏推荐
- The mega version model of dall-e MINI has been released and is open for download
- The foreground downloads network pictures without background processing
- The GPG keys listed for the "MySQL 8.0 community server" repository are already ins
- 豆瓣平均 9.x,分布式领域的 5 本神书!
- Seconds understand the delay and timing function of wechat applet
- 新一代云原生消息队列(一)
- Blackfly s usb3 industrial camera: buffer processing
- Word wrap when flex exceeds width
- 猫猫回收站
- Lidar: introduction and usage of ouster OS
猜你喜欢

【Unity】升级版·Excel数据解析,自动创建对应C#类,自动创建ScriptableObject生成类,自动序列化Asset文件

Alibaba cloud middleware open source past

Lumion 11.0 software installation package download and installation tutorial

Correct use of BigDecimal

处理streamlit库上传的图片文件

建议收藏!!Flutter状态管理插件哪家强?请看岛上码农的排行榜!

Introduction to FLIR blackfly s industrial camera

ROS learning (24) plugin

Stm32f4 --- general timer update interrupt

BigDecimal 的正确使用方式
随机推荐
MySQL execution process and sequence
Introduction to FLIR blackfly s industrial camera
真实项目,用微信小程序开门编码实现(完结)
Redis configuration class redisconfig
建議收藏!!Flutter狀態管理插件哪家强?請看島上碼農的排行榜!
Treadpoolconfig thread pool configuration in real projects
张平安:加快云上数字创新,共建产业智慧生态
ROS learning (XX) robot slam function package -- installation and testing of rgbdslam
激光雷达:Ouster OS产品介绍及使用方法
一片叶子两三万?植物消费爆火背后的“阳谋”
将截断字符串或二进制数据
[unique] what is the [chain storage structure]?
Lumion 11.0 software installation package download and installation tutorial
本周 火火火火 的开源项目!
Flir Blackfly S 工业相机:配置多个摄像头进行同步拍摄
[paper reading | deep reading] rolne: improving the quality of network embedding with structural role proximity
The last line of defense of cloud primary mixing department: node waterline design
传感器:土壤湿度传感器(XH-M214)介绍及stm32驱动代码
CISP-PTE实操练习讲解(二)
Recommended collection!! Which is the best flutter status management plug-in? Please look at the ranking list of yard farmers on the island!