当前位置:网站首页>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
边栏推荐
- @Before, @after, @around, @afterreturning execution sequence
- 阿里云中间件开源往事
- MySQL execution process and sequence
- Zabbix 5.0:通过LLD方式自动化监控阿里云RDS
- 解密函数计算异步任务能力之「任务的状态及生命周期管理」
- How can reinforcement learning be used in medical imaging? A review of Emory University's latest "reinforcement learning medical image analysis", which expounds the latest RL medical image analysis co
- 投资的再思考
- The foreground downloads network pictures without background processing
- Cat recycling bin
- TiFlash 源码阅读(四)TiFlash DDL 模块设计及实现分析
猜你喜欢
@Before, @after, @around, @afterreturning execution sequence
Infrared camera: juge infrared mag32 product introduction
处理streamlit库上传的图片文件
Blackfly s usb3 industrial camera: buffer processing
Several classes and functions that must be clarified when using Ceres to slam
The mega version model of dall-e MINI has been released and is open for download
Flir Blackfly S USB3 工业相机:白平衡设置方法
Blackfly S USB3工业相机:缓冲区处理
argo workflows源码解析
Analyze "C language" [advanced] paid knowledge [i]
随机推荐
freeswitch拨打分机号源代码跟踪
Introduction to RC oscillator and crystal oscillator
【论文阅读|深读】ANRL: Attributed Network Representation Learning via Deep Neural Networks
go swagger使用
TiFlash 源码阅读(四)TiFlash DDL 模块设计及实现分析
#yyds干货盘点# 解决名企真题:最大差值
Infrared camera: juge infrared mag32 product introduction
将截断字符串或二进制数据
张平安:加快云上数字创新,共建产业智慧生态
Command injection of cisp-pte
低代码平台中的数据连接方式(上)
[paper reading | deep reading] anrl: attributed network representation learning via deep neural networks
The empirical asset pricing package (EAP) can be installed through pypi
红外相机:巨哥红外MAG32产品介绍
微服务架构介绍
Dall-E Mini的Mega版本模型发布,已开放下载
Stm32f4 --- PWM output
Unicode string converted to Chinese character decodeunicode utils (tool class II)
Blackfly s usb3 industrial camera: buffer processing
企业中台建设新路径——低代码平台