PostgreSQL JDBC optimization method and system for ZNBase database

An optimization method and database technology, applied in the direction of electrical digital data processing, special data processing applications, digital data information retrieval, etc., can solve problems such as reducing SQL execution performance, and achieve the effect of improving execution performance and reducing communication.

Pending Publication Date: 2022-02-08
上海沄熹科技有限公司
View PDF0 Cites 0 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

Through PostgreSQL JDBC, you can establish a connection with a physical node of the database cluster. If the target data copy does not exist on the c

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • PostgreSQL JDBC optimization method and system for ZNBase database

Examples

Experimental program
Comparison scheme
Effect test

Embodiment 1

[0034] combined with figure 1 , present embodiment proposes a kind of PostgreSQL JDBC optimization method of ZNBase database, and its optimization content comprises:

[0035] Step S101, initialize the connection pool, thread pool and cache. in:

[0036] The connection pool is used to save the connection with the nodes in the database cluster.

[0037] The thread pool is used to start new threads, obtain SQL execution nodes, and store them in the cache, and the number of threads in the thread pool is the number of CPU cores of the database running the operating system*2.

[0038] The cache is used to store SQL and corresponding execution nodes. The cache reuses the LRUCache class in PostgreSQL JDBC, where the Key is an SQL string, the Value is a RouteInfo class, and the RouteInfo class stores the IP port and node number; through the SQL string, query in the cache to determine whether it is a hit cache.

[0039] Step S102, based on the LRUCache class in PostgreSQL JDBC, query

Embodiment 2

[0048]This embodiment proposes a PostgreSQL JDBC optimization system for a ZNBase database. Its implementation involves a cache, a connection pool, and a thread pool. The cache is used to store SQL and corresponding execution nodes, and the connection pool is used to store and connect nodes in the database cluster. connection, the thread pool is used to start a new thread, obtain the SQL execution node, and store it in the cache.

[0049] combined with figure 1 , the optimization system is based on cache, connection pool, thread pool, and the specific process of optimizing PostgreSQL JDBC includes:

[0050] Step S101, initialize the connection pool, thread pool and cache. in:

[0051] The connection pool is used to save the connection with the nodes in the database cluster.

[0052] The thread pool is used to start new threads, obtain SQL execution nodes, and store them in the cache, and the number of threads in the thread pool is the number of CPU cores of the database runnin

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

PUM

No PUM Login to view more

Abstract

The invention discloses a PostgreSQL JDBC optimization method and system for a ZNBase database, and relates to the technical field of database middleware, and the implementation content of the method comprises the following steps: querying whether a corresponding relationship between an SQL and an execution node is included in a cache based on an LRUCache class in the PostgreSQL JDBC; if the cache is not hit, starting a new thread by using the thread pool, obtaining an execution node of the SQL, adding the execution node and the SQL into the cache, establishing a connection at the execution node, storing the connection in the connection pool, and continuing to execute the SQL by using the current connection; if the cache is hit, the corresponding relation between the SQL and the execution node in the cache is firstly taken out, the execution node currently executing the SQL is obtained, then whether the connection of the execution node is contained in the connection pool is inquired, and if the connection of the execution node is contained in the connection pool, the current connection is replaced with the connection of the execution node inquired in the connection pool, and the SQL is executed. According to the method, the execution node of the ZNBase database operation is obtained, and the result is cached, so that the step of forwarding the SQL in the cluster is omitted, and the execution efficiency of the SQL is improved on the whole.

Description

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

Application Information

Patent Timeline
no application Login to view more
Owner 上海沄熹科技有限公司
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Try Eureka
PatSnap group products