DigitalChinaOpenSource / TiDB-for-PostgreSQL

PgSQL compatible on distributed database TiDB
Apache License 2.0
387 stars 21 forks source link

Optimize the data type acquisition method. Improve fault tolerance. #31

Open leeraya opened 3 years ago

leeraya commented 3 years ago

Function Description

This function is an enhancement. At present, TiBD for PostgreSQL implements the SetParamType method to obtain the data type through the volcano model. The specific code can be viewed in planner/core/plan.go for the definition of SetParamType() in PhysicalPlan and LogicalPlan and the implementation of SetParamType() in the sub-plan.

This is a new function proposed due to the difference between PostgreSQL extended query and MySQL pre-query protocol messages. We initially obtained the data types layer by layer through the volcano model thought. But the large number of virtual function calls that may be caused by the volcano model are also what we want to avoid.

This feature is mentioned in detail in other issues : https://github.com/DigitalChinaOpenSource/TiDB-for-PostgreSQL/issues/28

Therefore, an issue with optimized functions is proposed. Find a more direct way to get all the parameter types in the plan tree, replacing the current SetParamType().

Task list:

  1. Find a new and more efficient way to obtain parameter types and replace SetParamType.

Expected Results

Better performance of obtaining parameters and higher fault tolerance