Method and system for saving PostgresSQL shared memory

A technology for sharing memory and storing statistics, which is applied in the field of saving PostgreSQL shared memory, which can solve the problems of shared memory waste, consumption of shared memory, consumption, etc., and achieve the effect of avoiding great waste and ensuring the hit rate

Active Publication Date: 2015-07-29
SHANGHAI TAIYU INFORMATION TECH
View PDF5 Cites 2 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

For example, a table containing 100,000 records is set to occupy 1,000 8K data blocks. If there are 1,000 frequently accessed data, other than that, the rest of the data does not require frequent access. , if these 1000 frequently accessed records (data) are just distributed in 1000 data blocks, it will consume nearly 8MB of shared memory
That is to say, in order to improve the query efficiency of the 1000 active records in this table, nearly 8M of shared memory is required, resulting in a great waste of shared memory

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
  • Method and system for saving PostgresSQL shared memory

Examples

Experimental program
Comparison scheme
Effect test

Embodiment Construction

[0021] The specific implementation manners of the present invention will be further explained below in conjunction with the accompanying drawings.

[0022] Such as figure 1 The method shown to save PostgreSQL shared memory includes the following steps:

[0023] (1) Track and count the number of times tables are updated and queried;

[0024] (2) When the number of updates and queries meets the set conditions, data reorganization is triggered, and the rows where the filtered PK is located are reorganized into continuous data blocks.

[0025] In one embodiment, tracking and counting the number of times tables are updated and queried specifically includes the following steps:

[0026] Track and count the number of times tables are updated and queried during the process of executing SQL statements in the database through the PostgreSQL hook program; store statistical values. In the above process, in addition to the number of updates, the following content needs to be recorded: d...

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 provides a method for saving a PostgresSQL shared memory. The method comprises the steps of tracking and counting the times of updating and searching a table; if the times of updating and searching meet the set condition, triggering data reconstruction; reconstructing the row of the selected PK to a continuous data block; on the basis of 100000 records, 1000 8K data blocks are supposed to be used, and 1000 data are supposed to be accessed often, the method is that the 1000 records are stored in the continuous data block, and 10 8K data blocks are only needed, so that the 80K shared memory is needed, and as a result, the accuracy rate of the data access in the share area of the memory can be ensured, and the shared memory can be avoided large waste.

Description

technical field [0001] The invention relates to a method for saving PostgreSQL shared memory, and also relates to a system applying the method. Background technique [0002] When a user accesses the data in a PostgreSQL table, the data is first loaded into the shared memory area of ​​the database. Therefore, the more discrete the data distribution, the easier it is to cause waste of shared memory. [0003] In order to improve the hit rate of data access in the memory shared area, the general practice is to keep frequently accessed data in the memory. For example, a table containing 100,000 records is set to occupy 1,000 8K data blocks. If there are 1,000 frequently accessed data, other than that, the rest of the data does not require frequent access. , if these 1000 frequently accessed records (data) are just distributed in 1000 data blocks, it will need to consume nearly 8MB of shared memory. That is to say, in order to improve the query efficiency of the 1000 active reco...

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
IPC IPC(8): G06F17/30
Inventor 周正中
Owner SHANGHAI TAIYU INFORMATION TECH
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