当前位置:网站首页>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
边栏推荐
- go swagger使用
- Metaforce force meta universe development and construction - fossage 2.0 system development
- Time synchronization of livox lidar hardware -- PPS method
- [leetcode] day97 remove linked list elements
- Correct use of BigDecimal
- CISP-PTE之命令注入篇
- Flir Blackfly S 工业相机:通过外部触发实现多摄像头同步拍摄
- 处理streamlit库上传的图片文件
- Web开发小妙招:巧用ThreadLocal规避层层传值
- FLIR blackfly s industrial camera: explanation and configuration of color correction and code setting method
猜你喜欢
FLIR blackfly s industrial camera: synchronous shooting of multiple cameras through external trigger
ROS learning (21) robot slam function package -- installation and testing of orbslam
Schedulx v1.4.0 and SaaS versions are released, and you can experience the advanced functions of cost reduction and efficiency increase for free!
[unique] what is the [chain storage structure]?
Livox激光雷达硬件时间同步---PPS方法
leetcode:5. 最长回文子串【dp + 抓着超时的尾巴】
1500万员工轻松管理,云原生数据库GaussDB让HR办公更高效
BigDecimal 的正确使用方式
张平安:加快云上数字创新,共建产业智慧生态
STM32F4---PWM输出
随机推荐
【Unity】升级版·Excel数据解析,自动创建对应C#类,自动创建ScriptableObject生成类,自动序列化Asset文件
Several classes and functions that must be clarified when using Ceres to slam
[unique] what is the [chain storage structure]?
Yyds dry goods inventory # solve the real problem of famous enterprises: maximum difference
Twenty or thirty thousand a leaf? "Yang Mou" behind the explosion of plant consumption
云原生混部最后一道防线:节点水位线设计
强化学习如何用于医学影像?埃默里大学最新《强化学习医学影像分析》综述,阐述最新RL医学影像分析概念、应用、挑战与未来方向
Centos8 install MySQL 8.0 using yum x
MetaForce原力元宇宙开发搭建丨佛萨奇2.0系统开发
Analyze "C language" [advanced] paid knowledge [II]
Halcon实例转OpenCvSharp(C# OpenCV)实现--瓶口缺陷检测(附源码)
STM32F4---PWM输出
ROS learning (24) plugin
Introduction to microservice architecture
【论文阅读|深读】RolNE: Improving the Quality of Network Embedding with Structural Role Proximity
Analyze "C language" [advanced] paid knowledge [i]
argo workflows源码解析
Robot team learning method to achieve 8.8 times human return
Seconds understand the delay and timing function of wechat applet
使用Ceres进行slam必须要弄清楚的几个类和函数