Looking for breakthrough ideas for innovation challenges? Try Patsnap Eureka!

Ways to simplify postgresql partitioning code

A code and trigger technology, applied in the field of simplifying PostgreSQL partition code, can solve the problems that data cannot be inserted into the correct subtable and the probability of error is high

Active Publication Date: 2017-10-13
南通暴风网络科技有限公司
View PDF6 Cites 0 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0003] Disadvantages of the existing technology: Usually, each master table needs to correspond to at least one trigger function, so the more master tables, the more trigger functions need to be written, the greater the maintenance of the code, and the probability of errors also higher
If the trigger code is not modified in time, data will not be inserted into the correct subtable by 2015

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
  • Ways to simplify postgresql partitioning code

Examples

Experimental program
Comparison scheme
Effect test

Embodiment

[0025] A method to simplify the PostgreSQL partition code, including the following steps:

[0026] Step 1, create the main table,

[0027] Step 2, create a child table,

[0028] Step 3, create a trigger function,

[0029] Step 4: Create a before trigger and pass in four string parameters to simplify the PostgreSQL partition code.

[0030] The implementation steps of the trigger function include the following sub-steps:

[0031] Sub-step 1, the trigger function receives four string parameters,

[0032] Sub-step 2, the trigger function opens a cursor, and traverses the normal column names and corresponding data types from the metatable pg_catalog.pg_attribute according to the relid of the trigger,

[0033] Sub-step 3, the trigger function executes the encapsulated column name, and the format of each encapsulated column name is column_name,

[0034] Sub-step 4, the trigger function executes the encapsulated value, the format of each encapsulated value is NEW|OLD.TABLE_NAME.C...

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 relates to a method for simplifying PostgreSQL division codes. The method resolves the problems that as each main table needs to correspond to at least one trigger function, more main tables are, more trigger functions need writing, the maintenance workloads of the codes are larger and the error probability is higher. According to the technical scheme, the method includes the following steps of firstly, building the main tables, secondly, building secondary tables, thirdly, building trigger functions, and fourthly, building a before trigger, transmitting four character string parameters, and simplifying the PostgreSQL division codes. In the fourth step of the building the before trigger, the transmitted four character string parameters are schemaname, tablename, partition name and partition method respectively. In the first step, the trigger functions receive the four character string parameters of schemaname, tablename, partition name and partition method.

Description

technical field [0001] The invention is a PostgreSQL partition method, in particular to a method for simplifying PostgreSQL partition codes. Background technique [0002] The partition data routing of the PostgreSQL database is implemented through triggers. For example, a table has one partition table per month. The method that is transparent to the application is to use the main table and sub-table, create a trigger function on the main table, and the user accesses the main table. The trigger function judges which subtable the data is in based on the data passed by the user. [0003] Disadvantages of the existing technology: Usually, each main table needs to correspond to at least one trigger function, so the more main tables, the more trigger functions need to be written, the greater the maintenance of the code, and the probability of errors Also taller. Usually the trigger function uses static code, so once a sub-table is added, the trigger needs to be modified. For exa...

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
Patent Type & Authority Patents(China)
IPC IPC(8): G06F17/30
CPCG06F16/21
Inventor 周正中
Owner 南通暴风网络科技有限公司
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Patsnap Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Patsnap Eureka Blog
Learn More
PatSnap group products