WO2021008475A1 - 分布式数据库预处理方法及代理层、系统、存储介质 - Google Patents

分布式数据库预处理方法及代理层、系统、存储介质 Download PDF

Info

Publication number
WO2021008475A1
WO2021008475A1 PCT/CN2020/101571 CN2020101571W WO2021008475A1 WO 2021008475 A1 WO2021008475 A1 WO 2021008475A1 CN 2020101571 W CN2020101571 W CN 2020101571W WO 2021008475 A1 WO2021008475 A1 WO 2021008475A1
Authority
WO
WIPO (PCT)
Prior art keywords
database
request
session
client
prepared statement
Prior art date
Application number
PCT/CN2020/101571
Other languages
English (en)
French (fr)
Inventor
张军
Original Assignee
中兴通讯股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 中兴通讯股份有限公司 filed Critical 中兴通讯股份有限公司
Priority to EP20839782.8A priority Critical patent/EP3989064A4/en
Priority to JP2022500741A priority patent/JP2022540128A/ja
Priority to US17/625,567 priority patent/US11847116B2/en
Publication of WO2021008475A1 publication Critical patent/WO2021008475A1/zh

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/56Provisioning of proxy services
    • H04L67/568Storing data temporarily at an intermediate stage, e.g. caching
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2453Query optimisation
    • G06F16/24534Query rewriting; Transformation
    • G06F16/24539Query rewriting; Transformation using cached or materialised query results
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/242Query formulation
    • G06F16/2433Query languages
    • G06F16/2443Stored procedures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution
    • G06F16/24552Database cache management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/25Integrating or interfacing systems involving database management systems
    • G06F16/252Integrating or interfacing systems involving database management systems between a Database Management System and a front-end application
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • H04L67/146Markers for unambiguous identification of a particular session, e.g. session cookie or URL-encoding

Definitions

  • the present disclosure relates to but is not limited to the field of database technology.
  • Prepared statement is a general term for prepare, execute, and deallocate statements. Similar to stored procedures, it is a collection of SQL statements running in the background. Compared with the in-time SQL statement, the prepared statement divides the SQL statement into two parts, the first part is the same command and structure part, and the second part is the variable data part.
  • Preprocessing including lexical and semantic analysis, sentence optimization, execution plan formulation, etc.
  • prepared statements can prevent SQL injection.
  • the embodiment of the present disclosure provides a distributed database preprocessing method, which is applied to a database proxy layer.
  • the distributed database preprocessing method includes: receiving a prepared statement corresponding request; and according to the prepared statement corresponding request and preprocessing
  • the session identifier cached in the statement cache library is processed, and the session corresponding to the session identifier cached in the prepared statement cache library is a prepared statement session in which the client has successfully established a connection with the database.
  • the embodiment of the present disclosure also provides a database proxy layer, which includes a receiving module and a processing module.
  • the receiving module is used to receive a request corresponding to a prepared statement.
  • the processing module is used for processing according to the prepared statement corresponding request and the session identifier cached in the prepared statement cache library, and the session corresponding to the session identifier cached in the prepared statement cache library is the client and database success A connected prepared statement session has been established.
  • the embodiment of the present disclosure also provides a system including a client, a database, and the database proxy layer as described above.
  • the client sends a request corresponding to the prepared sentence to the database proxy layer.
  • the database proxy layer performs processing according to the received prepared statement corresponding request and the session identifier cached in the prepared statement cache library.
  • the session corresponding to the session identifier cached in the prepared statement cache library is the client and The database successfully established a connected prepared statement session.
  • the database maintains a connection with the session cached in the prepared statement cache library in the database proxy layer.
  • the embodiments of the present disclosure also provide a storage medium on which one or more programs are stored, and the one or more programs can be executed by one or more processors, so as to realize the distributed database prediction as described above. Processing method steps.
  • Fig. 1 is a schematic diagram of the basic flow of a distributed database preprocessing method according to an embodiment of the present disclosure
  • Fig. 2 is a schematic flow chart of a method for preprocessing a distributed database according to an embodiment of the present disclosure
  • Fig. 3 is a schematic diagram of the structure of a database proxy layer according to an embodiment of the present disclosure.
  • Fig. 4 is a schematic diagram of another structure of a database proxy layer according to an embodiment of the present disclosure.
  • a prepared statement corresponding request is received, and then a prepared statement corresponding request and a prepared statement cache library are received.
  • the session ID cached in it is processed.
  • the session corresponding to the session identifier cached in the prepared statement cache library is the prepared statement session in which the client has successfully established a connection with the database.
  • FIG. 1 the basic process of the distributed database preprocessing method according to the embodiment of the present disclosure includes steps S101 to S102.
  • step S101 a request corresponding to a prepared statement is received.
  • prepared statements include but are not limited to prepare, execute, and deallocate statements. In fact, as long as they belong to the prepared statement, they fall within the protection scope of the present disclosure, and the present disclosure does not specifically limit this.
  • this embodiment uses prepared statements including prepare, execute, and deallocate statements as examples.
  • step S102 processing is performed according to the prepared statement corresponding request and the session identifier cached in the prepared statement cache library.
  • the session corresponding to the session identifier cached in the prepared statement cache library is the preprocessing that the client has successfully established a connection with the database Statement session.
  • the session identifier in this embodiment is used to uniquely identify the session, for example, including but not limited to the session number. In actual applications, it can be flexibly adjusted according to specific application scenarios.
  • the database proxy layer when the database proxy layer receives the prepared statement corresponding request as a prepare request, it processes the prepared statement corresponding request and the session identifier cached in the prepared statement cache, including at least the following two cases.
  • Case 1 When the session identifier corresponding to the current prepare request session is queried in the prepared statement cache, the prepare request response message is sent to the client.
  • the prepared statement cache library of the database proxy layer caches the session identifier corresponding to the prepare request session, that is, the prepare request session corresponding to the query in the prepared statement cache library
  • the session identifier of indicates that the current prepare request has been processed.
  • the response message of the prepare request is sent directly to the client.
  • the prepare request mentioned in this embodiment has been processed means that the prepare request has been sent to the database once by the client and the session has been successfully established.
  • the session corresponding to the session identifier cached in the prepared statement cache library of the database proxy layer always remains connected to the database.
  • Case 2 When the session identifier corresponding to the current prepare request session is not queried in the prepared statement cache, the prepare request is sent to the database, and the database processes and sends the prepare request response message to the client.
  • the database proxy layer after the database proxy layer sends the prepare request to the database, and the database processes and sends the prepare request response message to the client, it also includes: caching the current prepare request session to the prepared statement cache library.
  • the session identifier in the prepared statement cache library of the database proxy layer is usually cached when the client sends to the database for the first time and the session is successfully established, so that when the client initiates a prepared statement corresponding request again , It can be queried in the prepared statement cache of the database proxy layer, and there is no need to send the corresponding request of the prepared statement to the database, thus saving the interaction between the client and the database.
  • the session identifier in the prepared statement cache library can also be cached when the client sends to the database for the Nth time and the session is successfully established, where N is greater than 1. In actual applications, the developer will use it according to the actual application. The scene can be adjusted flexibly.
  • the database proxy layer sends the prepare request to the database, and after the database processes and sends the prepare request response message to the client, the current prepare request session is cached to the prepared statement cache library so that the client can initiate the next time When the prepare request, only need to interact with the database proxy layer.
  • the database proxy layer when the database proxy layer receives the prepared statement corresponding request as an execute request, it processes the prepared statement corresponding request and the session identifier cached in the prepared statement cache, including at least the following two cases.
  • Case 1 When the session identifier corresponding to the idle prepare request session is queried in the prepared statement cache, the execute request is sent to the database, and the database processes and sends the response message of the execute request to the client.
  • Case 2 When the session identifier corresponding to the idle prepare request session is not queried in the prepared statement cache, wait until there is an idle prepare request session, and send the execute request to the database, which is processed by the database and sends the execute request Respond to the message to the client.
  • the session identifier corresponding to the idle prepare request session that is, the idle prepare cannot be queried in the prepared statement cache library
  • the session ID corresponding to the request session The session ID corresponding to the request session.
  • the execute request needs to be based on the processed prepare request. Therefore, in this case, you need to wait until the session ID corresponding to the idle prepare request session is queried in the prepared statement cache. Further, the execute request is sent to the database, and the database processes and sends a response message of the execute request to the client.
  • processing by the database and sending the response message of the execute request to the client includes: receiving a result set or failure message generated after the database executes the execute request, and sending the result set or failure message to the client.
  • the execute request is executed by the database, and the result set or failure message generated is sent to the database agent layer.
  • the database agent layer receives the result set or failure message, the result set or failure message is sent to the client end.
  • the client after sending the result set or failure message to the client, it further includes: when the received prepared statement corresponding to the request is a deallocate request, processing and sending a response message of the deallocate request to the client.
  • the client can disconnect from the database proxy layer as required, so when the database proxy layer receives the deallocate request, it processes and sends a response message of the deallocate request to the client.
  • processing and sending the response message of the deallocate request to the client includes: releasing the current session corresponding to the prepared statement successfully established with the client, and sending the response message of the deallocate request to the client.
  • the current prepare request session successfully established with the client can be released, and a response message of the deallocate request can be sent to the client to further save resources.
  • a prepared statement corresponding request is received, and then processed according to the prepared statement corresponding request and the session identifier cached in the prepared statement cache library, the session cached in the prepared statement cache library
  • the session corresponding to the identifier is a prepared statement session in which the client has successfully established a connection with the database, thereby solving the problem of low performance and efficiency of distributed database preprocessing.
  • the prepared statement session that has successfully established a connection between the client and the database is cached to the prepared statement cache library of the database proxy layer, and when the database proxy layer receives the preprocessing
  • the statement corresponds to the request, it can be processed through the session identifier in the prepared statement cache library, which avoids the phenomenon that the client needs to send the prepared statement to the database every time, and greatly reduces the load on the database.
  • the following takes a specific distributed database preprocessing method as an example to further illustrate the embodiments of the present disclosure. Please refer to FIG. 2.
  • the illustrated process includes the following steps S201 to S2018.
  • step S201 the client sends a prepare request to the database proxy layer.
  • step S202 the database proxy layer queries whether the prepare request session exists in the prepare session cached in the prepared statement cache library.
  • step S203 a response message of the prepare request is sent to the client when the query is reached.
  • step S204 when the link is not queried, the link is obtained and the prepare request is sent to the database.
  • step S205 the database sends a response message to the prepare request to the database proxy layer.
  • step S206 the database proxy layer sends a response message to the prepare request to the client.
  • step S207 the client sends an execute request to the database proxy layer.
  • step S208 the database proxy layer queries whether there is an idle prepare session among the prepare sessions cached in the prepared statement cache library.
  • step S209 when an idle prepare session is queried, an execute request is sent to the database.
  • step S2010 the database sends a response message of the execute request to the database proxy layer.
  • step S2011 the database proxy layer sends a response message of the execute request to the client.
  • step S2012 when no idle prepare session is found, the new link is obtained and the prepare request is sent to the database.
  • step S2013 the database sends a response message to the prepare request to the database proxy layer.
  • step S2014 the database proxy layer sends an execute request to the database.
  • step S2015 the database sends a response message of the execute request to the database proxy layer.
  • step S2016 the database proxy layer sends an execute response message to the client.
  • step S2017 the client sends a deallocate request to the database proxy layer.
  • step S2018 the database proxy layer sends a response message to the deallocate request to the client.
  • the prepare request and the session identifier corresponding to the execute execution session are cached in the prepared statement cache at the database proxy layer, so that the response message is directly returned when the prepare request hits, saving The interactive operation between the client and the database is achieved; the session is obtained when the execute request hits; and the session is released when the processing ends, without having to occupy the current session all the time, which improves the utilization of the session, thereby greatly improving the prediction of the distributed database Processing performance.
  • a database proxy layer is provided in the embodiment of the present disclosure, please refer to FIG. 3.
  • the database proxy layer includes a receiving module 301 and a processing module 302.
  • the receiving module 301 is used for receiving a prepared statement corresponding request.
  • the processing module 302 is used for processing according to the prepared statement corresponding request and the session identifier cached in the prepared statement cache library.
  • the session corresponding to the session identifier cached in the prepared statement cache library is the client that successfully establishes a connection with the database. Process the statement session.
  • prepared statements include but are not limited to prepare, execute, and deallocate statements. In fact, as long as they belong to the prepared statement, they fall within the protection scope of the present disclosure, and the present disclosure does not specifically limit this.
  • this embodiment uses prepared statements including prepare, execute, and deallocate statements as examples.
  • the session identifier in this embodiment is used to uniquely identify the session, for example, including but not limited to the session number. In actual applications, it can be flexibly adjusted according to specific application scenarios.
  • the processing module 302 when the receiving module 301 receives the prepared statement corresponding request as a prepare request, the processing module 302 performs processing according to the prepared statement corresponding request and the session identifier cached in the prepared statement cache, including at least the following two happening.
  • Case 1 When the processing module 302 finds the session identifier corresponding to the current prepare request session in the prepared statement cache, it sends a response message of the prepare request to the client.
  • the processing module 302 queries the prepared statement cache library for the prepare.
  • the session identifier corresponding to the requested session indicates that the current prepare request has been processed.
  • the response message of the prepare request is sent directly to the client, and there is no need to send the prepare request to the database, which saves the interaction between the client and the database.
  • the load of the database is reduced.
  • the prepare request mentioned in this embodiment has been processed means that the prepare request has been sent to the database once by the client and the session has been successfully established.
  • the session corresponding to the session identifier cached in the prepared statement cache of the database proxy layer always maintains a connection with the database.
  • Case 2 When the processing module 302 does not find the session identifier corresponding to the current prepare request session in the prepared statement cache, it sends the prepare request to the database, and the database processes and sends the prepare request response message to the client.
  • the processing module 302 cannot query the prepared statement cache library.
  • the session identifier corresponding to the prepare request session indicates that the current prepare request has not been processed. At this time, the prepare request still needs to be sent to the database for further processing.
  • the database proxy layer further includes a cache module 303.
  • the processing module 302 sends the prepare request to the database, and the database processes and sends the prepare request response message to the client. After that, the cache module 303 caches the current prepare request session to the prepared statement cache library.
  • the session identifier in the prepared statement cache library of the database proxy layer is usually cached when the client sends to the database for the first time and the session is successfully established, so that when the client initiates a prepared statement corresponding request again , It can be queried in the prepared statement cache of the database proxy layer, and there is no need to send the corresponding request of the prepared statement to the database, thus saving the interaction between the client and the database.
  • the session identifier in the prepared statement cache library can also be cached when the client sends to the database for the Nth time and the session is successfully established, where N is greater than 1. In actual applications, the developer will use it according to the actual application. The scene can be adjusted flexibly.
  • the cache module 303 caches the current prepare request session to the prepared statement cache library, so that the next time the client When the client initiates the prepare request, it only needs to interact with the database proxy layer.
  • the receiving module 301 when the receiving module 301 receives the prepared statement corresponding request as an execute request, it processes the prepared statement corresponding request and the session identifier cached in the prepared statement cache, including at least the following two cases.
  • Case 1 When the processing module 302 finds the session identifier corresponding to the idle prepare request session in the prepared statement cache library, it sends the execute request to the database, and the database processes and sends a response message of the execute request to the client.
  • the processing module 302 queries the idle prepared statement cache library The session ID corresponding to the prepare request session.
  • the execute request is sent to the database, and the database processes and sends the response message of the execute request to the client.
  • Case 2 When the processing module 302 does not find the session identifier corresponding to the idle prepare request session in the prepared statement cache library, it waits until there is an idle prepare request session, and sends the execute request to the database, which is processed and sent by the database The response message of the execute request to the client.
  • the session identifier corresponding to the idle prepare request session that is, the processing module 302 cannot be queried in the prepared statement cache library
  • the session ID corresponding to the idle prepare request session The session ID corresponding to the idle prepare request session.
  • the execute request needs to be based on the processed prepare request. Therefore, in this case, wait until the idle prepare request session is queried in the prepared statement cache.
  • the session identifier further, sends the execute request to the database, and the database processes and sends a response message of the execute request to the client.
  • the receiving module 301 is further configured to receive a result set or failure message generated after the database executes an execute request, and then the processing module 302 sends the result set or failure message to the client. It is understandable that the execute request is executed by the database, and the result set or failure message generated is sent to the receiving module 301. When the receiving module 301 receives the sending result set or failure message, the processing module 302 uses the result set or failure message. Then send to the client.
  • the processing module 302 processes and sends a response message of the deallocate request to the client. It is understandable that the client can disconnect the connection with the database proxy layer according to requirements. Therefore, when the receiving module 301 receives a deallocate request, the processing module 302 processes and sends a response message of the deallocate request to the client.
  • the processing module 302 releases the current session corresponding to the prepared statement successfully established with the client, and sends a response message of the deallocate request to the client.
  • the processing module 302 may release the currently successfully established prepare request session with the client, and send a response message of the deallocate request to the client, so as to further save resources.
  • the receiving module receives the prepared statement corresponding request, and the processing module performs processing according to the prepared statement corresponding request and the session identifier cached in the prepared statement cache library.
  • the session corresponding to the session identifier is a prepared statement session in which the client has successfully established a connection with the database, thereby solving the problem of low performance and efficiency of distributed database preprocessing. That is, according to the database proxy layer of the embodiment of the present disclosure, the prepared sentence session in which the client has successfully established a connection with the database is cached in the prepared sentence cache library.
  • the database proxy layer When the database proxy layer receives the prepared sentence corresponding request, it can The session identifier in the prepared statement cache library is used for processing to avoid the phenomenon that the client needs to send prepared statements to the database each time. Therefore, the database proxy layer according to the embodiment of the present disclosure is greatly reduced.
  • the database load improves the performance and efficiency of distributed database preprocessing and saves resources.
  • the embodiment of the present disclosure also provides a system, which includes a client, a database, and a database proxy layer.
  • the client sends a prepared statement corresponding request to the database proxy layer.
  • the database proxy layer performs processing according to the received prepared statement corresponding request and the session identifier cached in the prepared statement cache library.
  • the session corresponding to the session identifier cached in the prepared statement cache library is the one where the client has successfully established a connection with the database Prepared statement session.
  • the database maintains a connection with the session corresponding to the session identifier cached in the prepared statement cache library in the database proxy layer.
  • the system according to the embodiment of the present disclosure solves the problem of low performance and efficiency of distributed database preprocessing. Therefore, the system according to the embodiment of the present disclosure reduces the load of the database to a certain extent and improves the preprocessing of the distributed database. The performance and efficiency of processing saves resources.
  • the embodiment of the present disclosure further provides a storage medium, the storage medium stores one or more programs, and the one or more programs can be executed by one or more processors, so as to realize the distributed database preprocessing method according to the embodiments of the present disclosure A step of.
  • the storage medium includes volatile or non-volatile, removable or non-removable implemented in any method or technology for storing information (such as computer readable instructions, data structures, computer program modules, or other data) Medium.
  • Storage media includes but not limited to RAM (Random Access Memory), ROM (Read-Only Memory, read-only memory), EEPROM (Electrically Erasable Programmable read only memory), flash memory Or other memory technologies, CD-ROM (Compact Disc Read-Only Memory), digital versatile disk (DVD) or other optical disk storage, magnetic cassettes, magnetic tapes, disk storage or other magnetic storage devices, or can be used Any other medium that can store desired information and can be accessed by a computer.
  • the functional modules/units in the system, and the device can be implemented as software (which can be implemented by program code executable by a computing device) , Firmware, hardware and their appropriate combination.
  • the division between functional modules/units mentioned in the above description does not necessarily correspond to the division of physical components; for example, one physical component may have multiple functions, or one function or step may consist of several physical components. The components are executed cooperatively.
  • Some physical components or all physical components can be implemented as software executed by a processor, such as a central processing unit, a digital signal processor, or a microprocessor, or as hardware, or as an integrated circuit, such as an application specific integrated circuit .
  • the computer-readable medium may include computer storage Medium (or non-transitory medium) and communication medium (or temporary medium).
  • computer storage medium includes volatile and non-volatile memory implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules, or other data).
  • flexible, removable and non-removable media are examples of flexible, removable and non-removable media.
  • communication media usually contain computer-readable instructions, data structures, program modules, or other data in a modulated data signal such as carrier waves or other transmission mechanisms, and may include any information delivery media . Therefore, the present disclosure is not limited to any specific hardware and software combination.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Computational Linguistics (AREA)
  • Computing Systems (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Mathematical Physics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

一种分布式数据库预处理方法、数据库代理层、系统及存储介质,所述方法包括:接收预处理语句对应请求(S101);以及根据预处理语句对应请求以及预处理语句缓存库里缓存的会话标识进行处理,预处理语句缓存库里缓存的会话标识所对应的会话为客户端与数据库成功建立过连接的预处理语句会话(S102)。

Description

分布式数据库预处理方法及代理层、系统、存储介质 技术领域
本公开涉及但不限于数据库技术领域。
背景技术
预处理语句是对准备(prepare)、执行(execute)、释放(deallocate)语句的统称,类似于存储过程,是一种运行在后台的SQL语句集合。与及时SQL语句相比,预处理语句将SQL语句分为两个部分,第一部分为前面相同的命令和结构部分,第二部分为后面的可变数据的部分。在执行SQL语句的时候,首先将前面相同的命令和结构部分(SQL语句中的值用占位符替代,可以视为将SQL语句模板化或者说参数化)发送给数据库,让数据库事先进行一次预处理(包括词法语义解析、语句优化、制定执行计划等),然后执行预处理语句时仅需发送参数的数据。预处理语句的优势可归纳为:一次预处理、多次运行,省去了解析优化等过程,此外预处理语句能防止SQL注入。
分布式数据库目前已支持预处理,但是对于每次的预处理语句都会下发给底层数据库,并保持当前会话,直到预处理结束才会释放会话,因此会耗费大量的资源,并且在高并发的场景下频繁的下发预处理语句给数据库会增加数据库的负荷。可见,分布式数据库预处理的性能和效率均较低。
发明内容
本公开实施例提供了一种分布式数据库预处理方法,应用于数据库代理层,所述分布式数据库预处理方法包括:接收预处理语句对应请求;以及根据所述预处理语句对应请求以及预处理语句缓存库里缓存的会话标识进行处理,所述预处理语句缓存库里缓存的会话标识所对应的会话为客户端与数据库成功建立过连接的预处理语句会话。
本公开实施例还提供了一种数据库代理层,包括接收模块以及处理模块。所述接收模块用于接收预处理语句对应请求。所述处理模 块用于根据所述预处理语句对应请求以及预处理语句缓存库里缓存的会话标识进行处理,所述预处理语句缓存库里缓存的会话标识所对应的会话为客户端与数据库成功建立过连接的预处理语句会话。
本公开实施例还提供了一种系统,包括客户端、数据库以及如上述所述的数据库代理层。所述客户端发送所述预处理语句对应请求至所述数据库代理层。所述数据库代理层根据接收到的所述预处理语句对应请求以及预处理语句缓存库里缓存的会话标识进行处理,所述预处理语句缓存库里缓存的会话标识所对应的会话为客户端与数据库成功建立过连接的预处理语句会话。所述数据库保持与所述数据库代理层中的预处理语句缓存库里缓存的会话的连接。
本公开实施例还提供了一种存储介质,其上存储有一个或者多个程序,所述一个或者多个程序可被一个或者多个处理器执行,以实现如上述所述的分布式数据库预处理方法的步骤。
附图说明
下面将结合附图及实施例对本公开作进一步说明,附图中:
图1为根据本公开实施例的分布式数据库预处理方法的基本流程示意图;
图2为根据本公开实施例的分布式数据库预处理方法的具体的流程示意图;
图3为根据本公开实施例的数据库代理层的结构示意图;以及
图4为根据本公开实施例的数据库代理层的另一结构示意图。
具体实施方式
为了使本公开的目的、技术方案及优点更加清楚明白,下面通过具体实施方式结合附图对本公开实施例作进一步详细说明。应当理解,此处所描述的具体实施例仅仅用以解释本公开,并不用于限定本公开。
为了解决现有技术中分布式数据库预处理的性能和效率均较低的问题,在本公开实施例中,接收预处理语句对应请求,进而根据所 述预处理语句对应请求以及预处理语句缓存库里缓存的会话标识进行处理。预处理语句缓存库里缓存的会话标识所对应的会话为客户端与数据库成功建立过连接的预处理语句会话。请参见图1,如图1所示,根据本公开实施例的分布式数据库预处理方法的基本流程包括步骤S101至S102。
在步骤S101,接收预处理语句对应请求。
在本实施例中,预处理语句包括但不限于prepare、execute、deallocate语句,事实上,只要属于预处理语句均在本公开的保护的范畴内,对此本公开不做具体限定。
为了更好的理解本公开,本实施例以预处理语句包括prepare、execute、deallocate语句进行示例说明。
在步骤S102,根据预处理语句对应请求以及预处理语句缓存库里缓存的会话标识进行处理,预处理语句缓存库里缓存的会话标识所对应的会话为客户端与数据库成功建立过连接的预处理语句会话。
需要说明的是,本实施例中的会话标识用于唯一标识会话,例如包括但不限于会话号。在实际应用中,可根据具体应用场景做灵活调整。
在本实施例中,当数据库代理层接收到预处理语句对应请求为prepare请求时,根据预处理语句对应请求以及预处理语句缓存库里缓存的会话标识进行处理,包括至少以下两种情况。
情况一:当在预处理语句缓存库里查询到当前的prepare请求会话对应的会话标识时,发送prepare请求的响应消息至客户端。
可以理解的是,当接收到prepare请求,且数据库代理层的预处理语句缓存库里缓存了该prepare请求会话对应的会话标识时,即,在预处理语句缓存库里查询到该prepare请求会话对应的会话标识,表示当前的prepare请求已处理过,此时直接发送prepare请求的响应消息至客户端,无需再将prepare请求下发至数据库,节省了客户端与数据库的交互操作,在一定程度上降低了数据库的负荷。应当明确的是,本实施例提及的prepare请求已处理过表示该prepare请求由客户端已向数据库发送过一次且成功建立过会话。还应当明确的是, 数据库代理层的预处理语句缓存库里缓存的会话标识所对应的会话始终保持与数据库的连接。
情况二:当在预处理语句缓存库里未查询到当前的prepare请求会话对应的会话标识时,将prepare请求发送至数据库,由数据库处理并发送prepare请求的响应消息至客户端。
可以理解的是,当接收到prepare请求,但数据库代理层的预处理语句缓存库里未缓存该prepare请求会话对应的会话标识时,即,在预处理语句缓存库里无法查询到该prepare请求会话对应的会话标识,表示当前的prepare请求未处理过,此时仍需将该prepare请求下发至数据库,由数据库做进一步处理。
在本实施例中,在数据库代理层将prepare请求发送至数据库,由数据库处理并发送prepare请求的响应消息至客户端之后,还包括:缓存当前的prepare请求会话至预处理语句缓存库。
可以理解的是,数据库代理层的预处理语句缓存库里的会话标识通常是在客户端第一次向数据库发送且成功建立会话之时缓存的,这样当客户端再次发起预处理语句对应请求时,便可在数据库代理层的预处理语句缓存库里查询到,无需再将预处理语句对应请求下发至数据库,从而节省客户端与数据库的交互操作。值得注意的是,预处理语句缓存库里的会话标识也可以是在客户端第N次向数据库发送且成功建立会话时缓存的,其中N大于1,在实际应用中,由开发人员根据实际应用场景做灵活调整。
可选的,在数据库代理层将prepare请求发送至数据库,由数据库处理并发送prepare请求的响应消息至客户端之后,缓存当前的prepare请求会话至预处理语句缓存库,使得下次客户端再发起该prepare请求时,只需与数据库代理层进行交互操作即可。
在本实施例中,当数据库代理层接收到预处理语句对应请求为execute请求时,根据预处理语句对应请求以及预处理语句缓存库里缓存的会话标识进行处理,包括至少以下两种情况。
情况一:当在预处理语句缓存库里查询到空闲的prepare请求会话对应的会话标识时,将execute请求发送至数据库,由数据库处 理并发送execute请求的响应消息至客户端。
可以理解的是,当接收到execute请求,且数据库代理层的预处理语句缓存库里存在空闲的prepare请求会话对应的会话标识时,即,在预处理语句缓存库里查询到空闲的prepare请求会话对应的会话标识,此时将execute请求发送至数据库,由数据库处理并发送execute请求的响应消息至客户端。
情况二:当在预处理语句缓存库里未查询到空闲的prepare请求会话对应的会话标识时,等待直到有空闲的prepare请求会话,并将execute请求发送至数据库,由数据库处理并发送execute请求的响应消息至客户端。
可以理解的是,当接收到execute请求,但数据库代理层的预处理语句缓存库里不存在空闲的prepare请求会话对应的会话标识时,即,在预处理语句缓存库里无法查询到空闲的prepare请求会话对应的会话标识,此外,execute请求需要基于已处理过的prepare请求,因此,在这种情况下,需等待直到在预处理语句缓存库里查询到空闲的prepare请求会话对应的会话标识,进一步的,将execute请求发送至数据库,由数据库处理并发送execute请求的响应消息至客户端。
在本实施例中,由数据库处理并发送execute请求的响应消息至客户端,包括:接收由数据库执行execute请求后生成的结果集或失败消息,发送结果集或失败消息至客户端。
可以理解的是,由数据库执行execute请求,并生成的结果集或失败消息发送至数据库代理层,当数据库代理层接收到发送结果集或失败消息时,将该结果集或失败消息再发送至客户端。
在本实施例中,在将结果集或失败消息发送至客户端之后,还包括:当接收到预处理语句对应请求为deallocate请求时,处理并发送deallocate请求的响应消息至客户端。
可以理解的是,客户端可根据需求断开与数据库代理层的连接,因此当数据库代理层接收到deallocate请求时,处理并发送deallocate请求的响应消息至客户端。
在本实施例中,处理并发送deallocate请求的响应消息至客户端,包括:释放当前与客户端成功建立的预处理语句对应会话,并发送deallocate请求的响应消息至客户端。可选的,可以释放当前与客户端成功建立的prepare请求会话,并发送deallocate请求的响应消息至客户端,以进一步节省资源。
根据本公开实施例的分布式数据库预处理方法,接收预处理语句对应请求,进而根据预处理语句对应请求以及预处理语句缓存库里缓存的会话标识进行处理,预处理语句缓存库里缓存的会话标识所对应的会话为客户端与数据库成功建立过连接的预处理语句会话,从而解决了分布式数据库预处理的性能和效率均较低的问题。即,根据本公开实施例的分布式数据库预处理方法,缓存客户端与数据库成功建立过一次连接的预处理语句会话至数据库代理层的预处理语句缓存库内,当数据库代理层接收到预处理语句对应请求时,便可通过预处理语句缓存库内的会话标识进行处理,避免了客户端每次需将预处理语句下发至数据库的现象发生,在极大程度上降低了数据库的负荷,大大提高了分布式数据库预处理的性能和效率,节省了资源。
下面以一种具体的分布式数据库预处理方法为例对本公开实施例作进一步的示例说明,请参见图2,所示流程包括下列步骤S201至S2018。
在步骤S201,客户端发送prepare请求至数据库代理层。
在步骤S202,数据库代理层在预处理语句缓存库里缓存的prepare会话中查询是否存在该prepare请求会话。
在步骤S203,在查询到时发送prepare请求的响应消息至客户端。
在步骤S204,在未查询到时获取链路发送prepare请求至数据库。
在步骤S205,数据库发送prepare请求的响应消息至数据库代理层。
在步骤S206,数据库代理层发送prepare请求的响应消息至客户端。
在步骤S207,客户端发送execute请求至数据库代理层。
在步骤S208,数据库代理层在预处理语句缓存库里缓存的prepare会话中查询是否存在空闲的prepare会话。
在步骤S209,在查询到空闲的prepare会话时发送execute请求至数据库。
在步骤S2010,数据库发送execute请求的响应消息至数据库代理层。
在步骤S2011,数据库代理层发送execute请求的响应消息至客户端。
在步骤S2012,在未查询到空闲的prepare会话时获取新链路上发送prepare请求至数据库。
在步骤S2013,数据库发送prepare请求的响应消息至数据库代理层。
在步骤S2014,数据库代理层发送execute请求至数据库。
在步骤S2015,数据库发送execute请求的响应消息至数据库代理层。
在步骤S2016,数据库代理层发送execute响应消息至客户端。
在步骤S2017,客户端发送deallocate请求至数据库代理层。
在步骤S2018,数据库代理层发送deallocate请求的响应消息至客户端。
根据本公开实施例的分布式数据库预处理方法,在数据库代理层将prepare请求和execute执行会话对应的会话标识都缓存在预处理语句缓存库里,这样在prepare请求命中时直接返回响应消息,节省了客户端与数据库的交互的操作;在execute请求命中时获取会话;并且处理结束时释放会话,无需一直占用当前会话,提高了会话的利用率,从而在极大程度上提升了分布式数据库预处理的性能。
为了解决帧间预测模式下需要同时对运动矢量以及预测残差进行编码,编码性能较低的问题,在本公开实施例中提供了一种数据库代理层,请参见图3。
数据库代理层包括接收模块301以及处理模块302。
接收模块301用于接收预处理语句对应请求。
处理模块302用于根据预处理语句对应请求以及预处理语句缓存库里缓存的会话标识进行处理,预处理语句缓存库里缓存的会话标识所对应的会话为客户端与数据库成功建立过连接的预处理语句会话。
在本实施例中,预处理语句包括但不限于prepare、execute、deallocate语句,事实上,只要属于预处理语句均在本公开的保护的范畴内,对此本公开不做具体限定。
为了更好的理解本公开,本实施例以预处理语句包括prepare、execute、deallocate语句进行示例说明。
需要说明的是,本实施例中的会话标识用于唯一标识会话,例如包括但不限于会话号。在实际应用中,可根据具体应用场景做灵活调整。
在本实施例中,当接收模块301接收到预处理语句对应请求为prepare请求时,处理模块302根据预处理语句对应请求以及预处理语句缓存库里缓存的会话标识进行处理,包括至少以下两种情况。
情况一:当处理模块302在预处理语句缓存库里查询到当前的prepare请求会话对应的会话标识时,发送prepare请求的响应消息至客户端。
可以理解的是,当接收到prepare请求,且数据库代理层的预处理语句缓存库里缓存了该prepare请求会话对应的会话标识时,即,处理模块302在预处理语句缓存库里查询到该prepare请求会话对应的会话标识,表示当前的prepare请求已处理过,此时直接发送prepare请求的响应消息至客户端,无需再将prepare请求下发至数据库,节省了客户端与数据库的交互操作,在一定程度上降低了数据库的负荷。应当明确的是,本实施例提及的prepare请求已处理过表示该prepare请求由客户端已向数据库发送过一次且成功建立过会话。还应当明确的是,数据库代理层的预处理语句缓存库里缓存的会话标识所对应的会话始终保持与数据库的连接。
情况二:当处理模块302在预处理语句缓存库里未查询到当前 的prepare请求会话对应的会话标识时,将prepare请求发送至数据库,由数据库处理并发送prepare请求的响应消息至客户端。
可以理解的是,当接收到prepare请求,但数据库代理层的预处理语句缓存库里未缓存该prepare请求会话对应的会话标识时,即,处理模块302在预处理语句缓存库里无法查询到该prepare请求会话对应的会话标识,表示当前的prepare请求未处理过,此时仍需将该prepare请求下发至数据库,由数据库做进一步处理。
在本实施例中,可选的,请参见图4所示,数据库代理层还包括缓存模块303,在处理模块302将prepare请求发送至数据库,由数据库处理并发送prepare请求的响应消息至客户端之后,缓存模块303缓存当前的prepare请求会话至预处理语句缓存库。
可以理解的是,数据库代理层的预处理语句缓存库里的会话标识通常是在客户端第一次向数据库发送且成功建立会话之时缓存的,这样当客户端再次发起预处理语句对应请求时,便可在数据库代理层的预处理语句缓存库里查询到,无需再将预处理语句对应请求下发至数据库,从而节省客户端与数据库的交互操作。值得注意的是,预处理语句缓存库里的会话标识也可以是在客户端第N次向数据库发送且成功建立会话时缓存的,其中N大于1,在实际应用中,由开发人员根据实际应用场景做灵活调整。
可选的,在处理模块302将prepare请求发送至数据库,由数据库处理并发送prepare请求的响应消息至客户端之后,缓存模块303缓存当前的prepare请求会话至预处理语句缓存库,使得下次客户端再发起该prepare请求时,只需与数据库代理层进行交互操作即可。
在本实施例中,当接收模块301接收到预处理语句对应请求为execute请求时,根据预处理语句对应请求以及预处理语句缓存库里缓存的会话标识进行处理,包括至少以下两种情况。
情况一:当处理模块302在预处理语句缓存库里查询到空闲的prepare请求会话对应的会话标识时,将execute请求发送至数据库,由数据库处理并发送execute请求的响应消息至客户端。
可以理解的是,当接收到execute请求,且数据库代理层的预处理语句缓存库里存在空闲的prepare请求会话对应的会话标识时,即,处理模块302在预处理语句缓存库里查询到空闲的prepare请求会话对应的会话标识,此时将execute请求发送至数据库,由数据库处理并发送execute请求的响应消息至客户端。
情况二:当处理模块302在预处理语句缓存库里未查询到空闲的prepare请求会话对应的会话标识时,等待直到有空闲的prepare请求会话,并将execute请求发送至数据库,由数据库处理并发送execute请求的响应消息至客户端。
可以理解的是,当接收到execute请求,但数据库代理层的预处理语句缓存库里不存在空闲的prepare请求会话对应的会话标识时,即,处理模块302在预处理语句缓存库里无法查询到空闲的prepare请求会话对应的会话标识,此外,execute请求需要基于已处理过的prepare请求,因此,在这种情况下,需等待直到在预处理语句缓存库里查询到空闲的prepare请求会话对应的会话标识,进一步的,将execute请求发送至数据库,由数据库处理并发送execute请求的响应消息至客户端。
在本实施例中,接收模块301还用于接收由数据库执行execute请求后生成的结果集或失败消息,进而处理模块302发送结果集或失败消息至客户端。可以理解的是,由数据库执行execute请求,并生成的结果集或失败消息发送至接收模块301,当接收模块301接收到发送结果集或失败消息时,由处理模块302将该结果集或失败消息再发送至客户端。
在本实施例中,当接收模块301接收到预处理语句对应请求为deallocate请求时,处理模块302处理并发送deallocate请求的响应消息至客户端。可以理解的是,客户端可根据需求断开与数据库代理层的连接,因此当接收模块301接收到deallocate请求时,处理模块302处理并发送deallocate请求的响应消息至客户端。
在本实施例中,处理模块302释放当前与客户端成功建立的预处理语句对应会话,并发送deallocate请求的响应消息至客户端。 可选的,处理模块302可以释放当前与客户端成功建立的prepare请求会话,并发送deallocate请求的响应消息至客户端,以进一步节省资源。
根据本公开实施例的数据库代理层,接收模块接收预处理语句对应请求,进而处理模块根据预处理语句对应请求以及预处理语句缓存库里缓存的会话标识进行处理,预处理语句缓存库里缓存的会话标识所对应的会话为客户端与数据库成功建立过连接的预处理语句会话,从而解决了分布式数据库预处理的性能和效率均较低的问题。即,根据本公开实施例的数据库代理层,缓存客户端与数据库成功建立过一次连接的预处理语句会话至预处理语句缓存库内,当数据库代理层接收到预处理语句对应请求时,便可通过预处理语句缓存库内的会话标识进行处理,避免了客户端每次需将预处理语句下发至数据库的现象发生,因此,根据本公开实施例的数据库代理层在极大程度上降低了数据库的负荷,提高了分布式数据库预处理的性能和效率,节省了资源。
本公开实施例还提供了一种系统,该系统包括客户端、数据库以及数据库代理层。
客户端发送预处理语句对应请求至数据库代理层。
数据库代理层根据接收到的预处理语句对应请求以及预处理语句缓存库里缓存的会话标识进行处理,预处理语句缓存库里缓存的会话标识所对应的会话为客户端与数据库成功建立过连接的预处理语句会话。
数据库保持与数据库代理层中的预处理语句缓存库里缓存的会话标识所对应的会话的连接。
值得注意的是,为了不累赘说明,在本实施例中并未完全阐述所有示例,应当明确的是,前述实施例的所有示例均适用于本实施例。
根据本公开实施例的系统,解决了分布式数据库预处理的性能和效率均较低的问题,因此,根据本公开实施例的系统在一定程度上降低了数据库的负荷,提高了分布式数据库预处理的性能和效率,节省了资源。
本公开实施例还提供一种存储介质,存储介质存储有一个或者多个程序,一个或者多个程序可被一个或者多个处理器执行,以实现根据本公开实施例的分布式数据库预处理方法的步骤。
该存储介质包括在用于存储信息(诸如计算机可读指令、数据结构、计算机程序模块或其他数据)的任何方法或技术中实施的易失性或非易失性、可移除或不可移除的介质。存储介质包括但不限于RAM(Random Access Memory,随机存取存储器),ROM(Read-Only Memory,只读存储器),EEPROM(Electrically Erasable Programmable read only memory,带电可擦可编程只读存储器)、闪存或其他存储器技术、CD-ROM(Compact Disc Read-Only Memory,光盘只读存储器),数字多功能盘(DVD)或其他光盘存储、磁盒、磁带、磁盘存储或其他磁存储装置、或者可以用于存储期望的信息并且可以被计算机访问的任何其他的介质。
显然,本领域的技术人员应该明白,上文中所公开方法中的全部或某些步骤、系统、装置中的功能模块/单元可以被实施为软件(可以用计算装置可执行的程序代码来实现)、固件、硬件及其适当的组合。在硬件实施方式中,在以上描述中提及的功能模块/单元之间的划分不一定对应于物理组件的划分;例如,一个物理组件可以具有多个功能,或者一个功能或步骤可以由若干物理组件合作执行。某些物理组件或所有物理组件可以被实施为由处理器,如中央处理器、数字信号处理器或微处理器执行的软件,或者被实施为硬件,或者被实施为集成电路,如专用集成电路。这样的软件可以分布在计算机可读介质上,由计算装置来执行,并且在某些情况下,可以以不同于此处的顺序执行所示出或描述的步骤,计算机可读介质可以包括计算机存储介质(或非暂时性介质)和通信介质(或暂时性介质)。如本领域普通技术人员公知的,术语计算机存储介质包括在用于存储信息(诸如计算机可读指令、数据结构、程序模块或其他数据)的任何方法或技术中实施的易失性和非易失性、可移除和不可移除介质。此外,本领域普通技术人员公知的是,通信介质通常包含计算机可读指令、数据结构、程序模块或者诸如载波或其他传输机制之类的调制数据信号中的其 他数据,并且可包括任何信息递送介质。所以,本公开不限制于任何特定的硬件和软件结合。
以上内容是结合具体的实施方式对本公开实施例所作的进一步详细说明,不能认定本公开的具体实施只局限于这些说明。对于本公开所属技术领域的普通技术人员来说,在不脱离本公开构思的前提下,还可以做出若干简单推演或替换,都应当视为属于本公开的保护范围。

Claims (13)

  1. 一种分布式数据库预处理方法,应用于数据库代理层,所述分布式数据库预处理方法包括:
    接收预处理语句对应请求;以及
    根据所述预处理语句对应请求以及预处理语句缓存库里缓存的会话标识进行处理,
    其中,所述预处理语句缓存库里缓存的会话标识所对应的会话为客户端与数据库成功建立过连接的预处理语句会话。
  2. 如权利要求1所述的分布式数据库预处理方法,其中,响应于接收到预处理语句对应请求为准备prepare请求,根据所述预处理语句对应请求以及预处理语句缓存库里缓存的会话标识进行处理的步骤包括:
    响应于在所述预处理语句缓存库里查询到当前的prepare请求会话对应的会话标识,发送所述prepare请求的响应消息至所述客户端;
    响应于在所述预处理语句缓存库里未查询到当前的prepare请求会话对应的会话标识,将所述prepare请求发送至所述数据库,由所述数据库处理并发送所述prepare请求的响应消息至所述客户端。
  3. 如权利要求2所述的分布式数据库预处理方法,其中,在将所述prepare请求发送至所述数据库,由所述数据库处理并发送所述prepare请求的响应消息至所述客户端的步骤之后,所述方法还包括:
    缓存所述当前的prepare请求会话对应的会话标识至所述预处理语句缓存库。
  4. 如权利要求1至3中任一项所述的分布式数据库预处理方法,其中,响应于接收到预处理语句对应请求为执行execute请求,根据所述预处理语句对应请求以及预处理语句缓存库里缓存的会话标识 进行处理的步骤包括:
    响应于在所述预处理语句缓存库里查询到空闲的prepare请求会话对应的会话标识,将所述execute请求发送至所述数据库,由所述数据库处理并发送所述execute请求的响应消息至所述客户端;
    响应于在所述预处理语句缓存库里未查询到空闲的prepare请求会话对应的会话标识,等待直到有空闲的prepare请求会话,并将所述execute请求发送至所述数据库,由所述数据库处理并发送所述execute请求的响应消息至所述客户端。
  5. 如权利要求4所述的分布式数据库预处理方法,其中,由所述数据库处理并发送所述execute请求的响应消息至所述客户端的步骤包括:
    接收由所述数据库执行所述execute请求后生成的结果集或失败消息,并发送所述结果集或失败消息至所述客户端。
  6. 如权利要求5所述的分布式数据库预处理方法,其中,在将所述结果集或失败消息发送至所述客户端的步骤之后,所述方法还包括:
    响应于接收到预处理语句对应请求为释放deallocate请求,处理并发送所述deallocate请求的响应消息至所述客户端。
  7. 如权利要求6所述的分布式数据库预处理方法,其中,处理并发送所述deallocate请求的响应消息至所述客户端的步骤包括:
    释放当前与所述客户端建立的预处理语句对应会话,并发送所述deallocate请求的响应消息至客户端。
  8. 一种数据库代理层,包括接收模块以及处理模块,
    所述接收模块用于接收预处理语句对应请求;
    所述处理模块用于根据所述预处理语句对应请求以及预处理语句缓存库里缓存的会话标识进行处理,
    其中,所述预处理语句缓存库里缓存的会话标识所对应的会话为客户端与数据库成功建立过连接的预处理语句会话。
  9. 如权利要求8所述的数据库代理层,其中,所述处理模块用于:
    响应于在所述预处理语句缓存库里查询到当前的prepare请求会话对应的会话标识,发送所述prepare请求的响应消息至所述客户端;
    响应于在所述预处理语句缓存库里未查询到当前的prepare请求会话对应的会话标识,将所述prepare请求发送至所述数据库,由所述数据库处理并发送所述prepare请求的响应消息至所述客户端。
  10. 如权利要求9所述的数据库代理层,还包括缓存模块,所述缓存模块用于:
    在所述处理模块将所述prepare请求发送至数据库,由所述数据库处理并发送所述prepare请求的响应消息至所述客户端之后,缓存所述当前的prepare请求会话对应的会话标识至所述预处理语句缓存库。
  11. 如权利要求10所述的数据库代理层,其中,所述处理模块用于:
    响应于在所述预处理语句缓存库里查询到空闲的prepare请求会话对应的会话标识,将所述execute请求发送至所述数据库,由所述数据库处理并发送所述execute请求的响应消息至所述客户端;
    响应于在所述预处理语句缓存库里未查询到空闲的prepare请求会话对应的会话标识,等待直到有空闲的prepare请求会话,并将所述execute请求发送至所述数据库,由所述数据库处理并发送所述execute请求的响应消息至所述客户端。
  12. 一种系统,包括客户端、数据库以及如权利要求8至11中 任一项所述的数据库代理层;
    所述客户端发送预处理语句对应请求至所述数据库代理层;
    所述数据库代理层根据接收到的预处理语句对应请求以及预处理语句缓存库里缓存的会话标识进行处理,其中,所述预处理语句缓存库里缓存的会话标识所对应的会话为客户端与数据库成功建立过连接的预处理语句会话;
    所述数据库保持与所述数据库代理层中的预处理语句缓存库里缓存的会话标识所对应的会话的连接。
  13. 一种存储介质,其上存储有一个或者多个程序,所述一个或者多个程序被一个或者多个处理器执行时,所述一个或者多个处理器实现如权利要求1至7中任一项所述的分布式数据库预处理方法。
PCT/CN2020/101571 2019-07-17 2020-07-13 分布式数据库预处理方法及代理层、系统、存储介质 WO2021008475A1 (zh)

Priority Applications (3)

Application Number Priority Date Filing Date Title
EP20839782.8A EP3989064A4 (en) 2019-07-17 2020-07-13 DISTRIBUTED DATABASE PREPROCESSING METHOD, AGENT LAYER, SYSTEM AND RECORDING MEDIA
JP2022500741A JP2022540128A (ja) 2019-07-17 2020-07-13 分散型データベース前処理方法及びプロキシ層、システム、記憶媒体
US17/625,567 US11847116B2 (en) 2019-07-17 2020-07-13 Distributed database preprocessing method, agent layer, system and storage medium

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910647652.7 2019-07-17
CN201910647652.7A CN112241418B (zh) 2019-07-17 2019-07-17 分布式数据库预处理方法及代理层、系统、存储介质

Publications (1)

Publication Number Publication Date
WO2021008475A1 true WO2021008475A1 (zh) 2021-01-21

Family

ID=74167727

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/101571 WO2021008475A1 (zh) 2019-07-17 2020-07-13 分布式数据库预处理方法及代理层、系统、存储介质

Country Status (5)

Country Link
US (1) US11847116B2 (zh)
EP (1) EP3989064A4 (zh)
JP (1) JP2022540128A (zh)
CN (1) CN112241418B (zh)
WO (1) WO2021008475A1 (zh)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114880662B (zh) * 2022-07-12 2022-09-23 北京安华金和科技有限公司 一种基于进程的数据库审计处理方法和装置
US11943316B1 (en) * 2022-12-02 2024-03-26 Amazon Technologies, Inc. Database connection multiplexing for prepared statements

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104636131A (zh) * 2014-12-12 2015-05-20 北京奇虎科技有限公司 一种特殊指令的执行方法及装置
CN104811488A (zh) * 2015-04-13 2015-07-29 深信服网络科技(深圳)有限公司 基于负载均衡设备的会话保持方法及系统和负载均衡设备
CN105141676A (zh) * 2015-08-11 2015-12-09 北京思特奇信息技术股份有限公司 一种多服务器下的会话保持共享方法及系统
CN107370818A (zh) * 2017-07-31 2017-11-21 郑州云海信息技术有限公司 一种分布式会话对象管理方法及系统

Family Cites Families (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7024406B1 (en) * 2001-06-01 2006-04-04 Oracle International Corporation Driver and method for processing a database statement
US7356523B2 (en) * 2002-05-23 2008-04-08 International Business Machines Corporation Dynamic optimization of prepared statements in a statement pool
US8346761B2 (en) * 2004-08-05 2013-01-01 International Business Machines Corporation Method and system for data mining for automatic query optimization
US8943181B2 (en) * 2005-11-29 2015-01-27 Ebay Inc. Method and system for reducing connections to a database
US8260761B2 (en) * 2006-10-20 2012-09-04 Ianywhere Solutions, Inc. Detecting performance degrading design and algorithm issues in database applications
CN101309514B (zh) * 2008-06-10 2012-07-04 中兴通讯股份有限公司 会话接入方法及系统
US8996503B2 (en) * 2010-10-04 2015-03-31 Sybase, Inc. Query plan optimization for prepared SQL statements
US9846724B2 (en) * 2014-11-13 2017-12-19 Sap Se Integration of calculation models into SQL layer
CN105740244A (zh) * 2014-12-08 2016-07-06 阿里巴巴集团控股有限公司 一种提供会话快捷消息的方法及设备
CN105912949B (zh) * 2016-04-13 2019-11-05 北京京东尚科信息技术有限公司 数据权限管理方法、数据权限管理系统以及业务管理系统
CN107766378A (zh) * 2016-08-22 2018-03-06 南京中兴新软件有限责任公司 请求信息的发送方法及装置、分布式数据库系统
CN107980128B (zh) * 2016-11-07 2019-07-26 深圳力维智联技术有限公司 数据对接动态管理方法及装置
US10664473B2 (en) * 2017-01-30 2020-05-26 International Business Machines Corporation Database optimization based on forecasting hardware statistics using data mining techniques
US11012429B2 (en) * 2018-12-05 2021-05-18 Citrix Systems, Inc. Method to save computational resources by detecting encrypted payload
US11216482B2 (en) * 2019-04-11 2022-01-04 Citrix Systems, Inc. Systems and methods for access to multi-tenant heterogeneous databases

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104636131A (zh) * 2014-12-12 2015-05-20 北京奇虎科技有限公司 一种特殊指令的执行方法及装置
CN104811488A (zh) * 2015-04-13 2015-07-29 深信服网络科技(深圳)有限公司 基于负载均衡设备的会话保持方法及系统和负载均衡设备
CN105141676A (zh) * 2015-08-11 2015-12-09 北京思特奇信息技术股份有限公司 一种多服务器下的会话保持共享方法及系统
CN107370818A (zh) * 2017-07-31 2017-11-21 郑州云海信息技术有限公司 一种分布式会话对象管理方法及系统

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
See also references of EP3989064A4 *

Also Published As

Publication number Publication date
EP3989064A1 (en) 2022-04-27
CN112241418A (zh) 2021-01-19
US11847116B2 (en) 2023-12-19
US20220292096A1 (en) 2022-09-15
EP3989064A4 (en) 2022-08-10
CN112241418B (zh) 2023-04-18
JP2022540128A (ja) 2022-09-14

Similar Documents

Publication Publication Date Title
JP6949118B2 (ja) ブロックチェーンサービス受付けおよびコンセンサス方法およびデバイス
US10296462B2 (en) Method to accelerate queries using dynamically generated alternate data formats in flash cache
US10715622B2 (en) Systems and methods for accelerating object stores with distributed caching
US8818989B2 (en) Memory usage query governor
WO2021008475A1 (zh) 分布式数据库预处理方法及代理层、系统、存储介质
US8301798B2 (en) System and method for processing large amounts of transactional data
WO2018120171A1 (zh) 一种用于存储过程的执行方法、设备以及系统
US9836516B2 (en) Parallel scanners for log based replication
US20120150895A1 (en) Maximum allowable runtime query governor
CN110737388A (zh) 数据预读方法、客户端、服务器以及文件系统
CN108459913B (zh) 数据并行处理方法、装置及服务器
CN110781244A (zh) 用于对数据库的并发操作进行控制的方法及装置
US9870396B2 (en) Immediate join spilling scheme for a database
US9189405B2 (en) Placement of data in shards on a storage device
US11005776B2 (en) Resource allocation using restore credits
CN111221642B (zh) 一种数据处理方法、装置、存储介质及终端
US8850443B2 (en) Asynchronous input/output (I/O) using alternate stack switching in kernel space
US20230222102A1 (en) High-performance remote file system meta data
WO2018196459A1 (zh) 一种下载请求处理方法、装置、处理设备及介质
CN108075989B (zh) 一种基于可扩展协议的负载均衡网络中间件实现方法
CN113961586A (zh) 一种sql语句的控制方法及装置
CN112784139A (zh) 查询方法、装置、电子设备和计算机可读介质
US20230396687A1 (en) Application service behavior management using request context
CN108762666B (zh) 一种存储系统的访问方法、系统、介质及设备
CN117453426A (zh) 一种延时消费方法、装置、电子设备及存储介质

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20839782

Country of ref document: EP

Kind code of ref document: A1

ENP Entry into the national phase

Ref document number: 2022500741

Country of ref document: JP

Kind code of ref document: A

NENP Non-entry into the national phase

Ref country code: DE

ENP Entry into the national phase

Ref document number: 2020839782

Country of ref document: EP

Effective date: 20220121