CN101082928B - Method for accessing database and data-base mapping system - Google Patents

Method for accessing database and data-base mapping system Download PDF

Info

Publication number
CN101082928B
CN101082928B CN2007100761623A CN200710076162A CN101082928B CN 101082928 B CN101082928 B CN 101082928B CN 2007100761623 A CN2007100761623 A CN 2007100761623A CN 200710076162 A CN200710076162 A CN 200710076162A CN 101082928 B CN101082928 B CN 101082928B
Authority
CN
China
Prior art keywords
record
database
internal memory
shared drive
server end
Prior art date
Legal status (The legal status 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 status listed.)
Active
Application number
CN2007100761623A
Other languages
Chinese (zh)
Other versions
CN101082928A (en
Inventor
华有为
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Tencent Cloud Computing Beijing Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
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 Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN2007100761623A priority Critical patent/CN101082928B/en
Publication of CN101082928A publication Critical patent/CN101082928A/en
Application granted granted Critical
Publication of CN101082928B publication Critical patent/CN101082928B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses a calling method of database and mapping system of the database in the database technical domain, which comprises the following steps: calculating the recorded internal memory mapping address according to key field value of each record in the database at server end; mapping each record in the database at server end into internal memory mapping address of shared internal memory of customer end; calling the shared internal memory directly to call the database at server end. The invention makes user call database through calling the shared internal memory directly withoutlimited by network speed, which satisfies the need of real-time of database calling for users.

Description

A kind of method of database access and Database Mapping system
Technical field
The invention belongs to database technical field, relate in particular to a kind of method and Database Mapping system of database access.
Background technology
Database is meant and is long-term stored at set in the computing machine, organized, sharable data that being widely used in fields such as computing machine, network service provides data sharing for various users.At present, the method for fulfillment database visit mainly contains two kinds:
One of method: client is directly edited standard SQL sentence (database access statement), and the SQL statement after will editing is transmitted through the network to the Database Systems of server end, the Database Systems of server end make an explanation, compile, carry out the SQL statement that receives, and final execution result is transferred to client.Wherein, the Data Transport Protocol of server end and client can adopt multiple mode, as transmission control protocol/iso-ip Internetworking protocol ISO-IP (Transmission Control Protocol/Internet Protocol, TCP/IP), User Datagram Protoco (UDP) (User Datagram Protocol, UDP), pipeline, Signaling System Number 7 etc.
In above-mentioned data bank access method, the client user is by the database of network access server end, make the speed of client user accesses database be subjected to the restriction of network rate, and can only reach 100,000 grades of other database access speed, can't satisfy the demand of user to the real-time of database access.
Two of method: client visits the database of server end by middleware.The fixed interface that middleware Technology can provide some to call for the client user, middleware is dressed up standard SQL sentence according to key word such as dynamic group such as table name, field name that the client user provides, and the SQL statement of assembling is transmitted through the network to server end.
Said method with the client user when the accessing database, the operation that regenerates standard SQL sentence is given middleware and is finished, simplified client user's database access operation, but can make access of database speed be subjected to the restriction of network rate equally by transmitted data on network, and can only reach 100,000 grades of other database access speed, can't satisfy the demand of user equally to the real-time of database access.
Summary of the invention
The purpose of the embodiment of the invention is to provide a kind of method of database access, be intended to solve in the prior art, when accessing database, need be by network in server end and client transmissions data, thereby make database access speed be subjected to the restriction of network rate, can't reach the problem of user the demand of the real-time of database access.
The embodiment of the invention is achieved in that a kind of method of database access, and described method comprises the steps:
Calculate the internal memory mapping address of described record according to the primary key value of every record in the server end database according to pre-configured hash function, described hash function is: primary key value MOD address prime number in internal memory mapping address=record;
For every in described server end database record adds the mapping timestamp;
Judge whether described client shared drive is full,, then eliminate the described mapping timestamp record the earliest in the described client shared drive if described client shared drive is full;
Every record in the described server end database is mapped in the described internal memory mapping address of client shared drive;
Client visits described server end database by the described shared drive of direct visit.
Another purpose of the embodiment of the invention is to provide a kind of Database Mapping system, and described system comprises:
The internal memory mapping address computing module, be used for calculating the internal memory mapping address of described record according to the primary key value of every record of server end database according to pre-configured hash function, described hash function is: primary key value MOD address prime number in internal memory mapping address=record;
The mapping timestamp adds module, is used to every record in the described server end database to add the mapping timestamp;
The memory headroom judge module is used to judge whether described client shared drive is full; And
Module eliminated in record, is used for eliminating the described mapping timestamp record the earliest in the described client shared drive when described client shared drive is expired; And
The Database Mapping module is used for every record of described server end database is mapped in the described internal memory mapping address of client shared drive.
In embodiments of the present invention, by each the bar record in the server end database is mapped in the client shared drive, thereby make the client user not need database by the network access server end, directly visit database by the access client shared drive, make database access not be subjected to the restriction of network rate, can reach 1,000,000 grades of other database access speed, satisfy the demand of user the real-time of database access.
Description of drawings
Fig. 1 is the realization flow figure of the method for the database access that provides of the embodiment of the invention;
Fig. 2 is another realization flow figure of the method for the database access that provides of the embodiment of the invention;
Fig. 3 is the realization flow figure that employing data bank access method that the embodiment of the invention provides is searched record;
Fig. 4 is the structural drawing of the Database Mapping system that provides of the embodiment of the invention.
Embodiment
In order to make purpose of the present invention, technical scheme and advantage clearer,, the present invention is further elaborated below in conjunction with drawings and Examples.Should be appreciated that specific embodiment described herein only in order to explanation the present invention, and be not used in qualification the present invention.
In embodiments of the present invention, be mapped to by database table in the shared drive of client, thereby make the client user reach 1,000,000 grades of other database access speed, to satisfy the demand of client user the real-time of database access with server end.
Fig. 1 shows the realization flow of the method for the database access that the embodiment of the invention provides, and details are as follows:
In step S101, for every in server end database record adds the mapping timestamp, free memory with convenient client shared drive is limited, in the time of all records in the server end database all can not being mapped to this shared drive, can map to the record of the superseded part mapping of time value of shared drive according to every record to shared drive.Time value when wherein shining upon timestamp and be every record in the database and mapping to shared drive.The structure of having added mapping timestamp each wall scroll record afterwards is as shown in the table:
Timestamp 1 Data-base recording 1
Timestamp 2 Data-base recording 2
... ...
Timestamp N Data-base recording N
In step S102, judge whether the space of client shared drive is full, if the space of client shared drive is full, execution in step S103 then, otherwise execution in step S104.
In step S103, eliminate the mapping timestamp record early that maps in the client shared drive.
In step S104, calculate the internal memory mapping address of this record correspondence according to pre-configured hash function (Hash function) according to the primary key value of every record in the server end database.Wherein the general formula of hash function is: primary key value MOD address prime number in internal memory mapping address=record, and wherein the address prime number is in order to obtain better hash function, the user sums up through test of many times and the value of configuration (as 5,7 etc.).For example in database, exist primary key value to be respectively 8,10,14,15,18,23, during 20,34 record, if the address prime number is configured to 5, after above-mentioned hash function calculated, the internal memory mapping address that then has the record of above-mentioned primary key value was respectively: 3,0,4,0,3,3,0,4; If the address prime number is configured to 7, after above-mentioned hash function calculated, the internal memory mapping address that then has the record of above-mentioned primary key value was respectively: 1,3,0,1,4,2,6,6.As mentioned above, have each record of different primary key values, after hash function calculates, may obtain identical internal memory mapping address, promptly an internal memory mapping address may corresponding plurality of records.
In step S105, each record in the server end database is mapped in the correspondence memory mapping address of client shared drive.After mapping, database is as shown in the table at the storage organization of memory storage area:
Figure GSB00000101445200051
In embodiments of the present invention, for each record with same memory mapping address, in the time of in mapping to shared drive, adopt array that all records with same memory mapping address are managed, the length of this array can preestablish, in embodiments of the present invention, be that example describes with 100.When the record with same memory mapping address during more than 100, preceding 100 records will be mapped in the internal memory mapping address corresponding in the shared drive that the primary key value according to each record calculates, later have being recorded in of same memory mapping address when being mapped in the shared drive for 100, whether the method for employing linear probing is surveyed next internal memory mapping address one by one idle, if idle, then this record is mapped in this idle internal memory mapping address.Wherein the number of address linear probing is preestablished by the user.
In step S106, client directly visits database by visiting this shared drive.The client user can directly visit above-mentioned client shared drive and visit the database that maps in this shared drive, thereby can reach 1,000,000 grades of other database access speed, and be not subjected to the influence of network rate, satisfied the demand of user to the real-time of database access.
Fig. 2 shows the realization flow of the method for the database access that second embodiment of the invention provides, and the difference of itself and first embodiment is, the execution sequence of this method step is adjusted.
In step S201, calculate the internal memory mapping address of this record correspondence according to pre-configured hash function according to the primary key value of every record in the server end database;
In step S202, for every in server end database record adds the mapping timestamp;
In step S203, judge whether the space of client shared drive is full, if the space of client shared drive is full, execution in step S204 then, otherwise execution in step S205;
In step S204, eliminate the mapping timestamp record early that maps in the client shared drive;
In step S205, each record in the server end database is mapped in the correspondence memory mapping address of client shared drive,
In step S206, directly visit database by visiting this shared drive.
The flow process that the employing data bank access method that Fig. 3 shows the embodiment of the invention to be provided is searched record.
In step S301, receive the primary key value of the record of input.After adopting above-mentioned data bank access method to map to all records in the server end database in the client shared drive, receive the primary key value of the record of client user's input.
In step S302, adopt the hash function of above-mentioned configuration to calculate the corresponding internal memory mapping address of this record according to this primary key value.
In step S303, judge in the internal memory mapping address calculate whether have the record identical with the primary key value of this record, if there is no, and execution in step S304 then, if exist, execution in step S307 then.
In step S304, judge whether the number of addresses of surveying surpasses predefined value.Because when each the bar record in the server end database is mapped to the client shared drive, calculate through hash function for plurality of records with different field key values, may obtain identical internal memory mapping address, when configuration, defined the bar number of the record of same internal memory mapping address correspondence, for record with same memory mapping address more than limit value, adopt the mode of address linear probing, this record more than limit value is filled into next internal memory mapping address.And when carrying out the address linear probing, the number of addresses of address linear probing that the user is also pre-configured, so in this step, whether the number that need judge the address of current detection exceeds pre-configured number of addresses, if do not exceed, execution in step S305 then, if exceed, execution in step S306 then.
In step S305, after will surveying the address and increasing by 1, re-execute step S303.
In step S306, the internal memory mapping address of not finding this record correspondence and the result who does not find this record are surveyed and returned to halt address.
In step S307, return the internal memory mapping address of the record that finds, return the record that finds to the client user.
Fig. 4 shows the structure of the Database Mapping system that the embodiment of the invention provides, and for convenience of explanation, the part relevant with the embodiment of the invention only is shown.
Internal memory mapping address computing module 31 adopts pre-configured hash function to calculate this record according to the primary key value of each record in the database and is mapped to internal memory mapping address in the shared drive.Database Mapping module 32 is mapped to each the bar record in the database in the internal memory mapping address of the client shared drive that is calculated by internal memory mapping address computing module 31, the Database Mapping of server end to the client shared drive after, the storage organization that respectively is recorded in client shared drive memory block does not repeat them here as mentioned above.
Each record in the server end database is being mapped in the process of client shared drive, when the free space of client shared drive limited, in the time of each record in the server end database all can't being mapped to the client shared drive, the Database Mapping system that the embodiment of the invention provides adds module 33 by the mapping timestamp and adds corresponding mapping timestamp for each record in the server end database, in order to identify the time of this record when mapping to the client shared drive.Wherein added mapping timestamp structure that respectively writes down afterwards as mentioned above, do not repeated them here.Memory headroom judge module 34 judges whether this shared drive is full before each the bar record in the server end database is mapped to the client shared drive.When the free space of this shared drive limited, in the time of all records in the database all can't being mapped to this shared drive, promptly this shared drive is full, then eliminate module 35 and eliminate mapping timestamp record early by record, so that other record in the database can map to this shared drive, the client user can be directly shared drive by access client visit database, thereby can reach 1,000,000 grades of other database access speed, and be not subjected to the restriction of network rate, satisfied the demand of client user to the real-time of database access.
In sum, in embodiments of the present invention, by every record in the server end database is mapped in the client shared drive, when client needs the database of access server end, direct access map database to the client shared drive, make database access not be subjected to the restriction of network rate, thereby can reach 1,000,000 grades of other database access speed, satisfied the demand of client user the real-time of database access.
The above only is preferred embodiment of the present invention, not in order to restriction the present invention, all any modifications of being done within the spirit and principles in the present invention, is equal to and replaces and improvement etc., all should be included within protection scope of the present invention.

Claims (4)

1. the method for a database access is characterized in that, described method comprises the steps:
Calculate the internal memory mapping address of described record according to the primary key value of every record in the server end database according to pre-configured hash function, described hash function is: primary key value MOD address prime number in internal memory mapping address=record;
For every in described server end database record adds the mapping timestamp;
Judge whether described client shared drive is full,, then eliminate the described mapping timestamp record the earliest in the described client shared drive if described client shared drive is full;
Every record in the described server end database is mapped in the described internal memory mapping address of client shared drive;
Client visits described server end database by the described shared drive of direct visit.
2. the method for database access as claimed in claim 1, it is characterized in that, when the primary key value according to every record in the server end database calculates the internal memory mapping address of described record, if there is the internal memory mapping address of plurality of records identical, in the time of then in the described internal memory mapping address that described record is mapped to the client shared drive, adopt array that described plurality of records with same memory mapping address is managed.
3. a Database Mapping system is characterized in that, described system comprises:
The internal memory mapping address computing module, be used for calculating the internal memory mapping address of described record according to the primary key value of every record of server end database according to pre-configured hash function, described hash function is: primary key value MOD address prime number in internal memory mapping address=record;
The mapping timestamp adds module, is used to every record in the described server end database to add the mapping timestamp;
The memory headroom judge module is used to judge whether described client shared drive is full; And
Module eliminated in record, is used for eliminating the described mapping timestamp record the earliest in the described client shared drive when described client shared drive is expired; And
The Database Mapping module is used for every record of described server end database is mapped in the described internal memory mapping address of client shared drive.
4. Database Mapping as claimed in claim 3 system, it is characterized in that, internal memory mapping address as plurality of records is identical, in the time of then in the described internal memory mapping address that described record is mapped to the client shared drive, adopt array that described plurality of records with same memory mapping address is managed.
CN2007100761623A 2007-06-25 2007-06-25 Method for accessing database and data-base mapping system Active CN101082928B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN2007100761623A CN101082928B (en) 2007-06-25 2007-06-25 Method for accessing database and data-base mapping system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN2007100761623A CN101082928B (en) 2007-06-25 2007-06-25 Method for accessing database and data-base mapping system

Publications (2)

Publication Number Publication Date
CN101082928A CN101082928A (en) 2007-12-05
CN101082928B true CN101082928B (en) 2010-11-24

Family

ID=38912501

Family Applications (1)

Application Number Title Priority Date Filing Date
CN2007100761623A Active CN101082928B (en) 2007-06-25 2007-06-25 Method for accessing database and data-base mapping system

Country Status (1)

Country Link
CN (1) CN101082928B (en)

Families Citing this family (20)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102098446B (en) * 2009-12-09 2015-05-27 新奥特(北京)视频技术有限公司 Real-time data storage method and device for caption broadcasting system
CN102156700A (en) * 2010-02-12 2011-08-17 华为技术有限公司 Database accessing method and device and system
CN101872356B (en) * 2010-05-31 2013-08-07 中兴通讯股份有限公司 Method and system for improving processing performance of memory database
CN101986649B (en) * 2010-11-29 2014-01-15 深圳天源迪科信息技术股份有限公司 Shared data center used in telecommunication industry billing system
CN102420814A (en) * 2011-11-21 2012-04-18 航天科工深圳(集团)有限公司 Data access method and device, and server
CN102609466B (en) * 2012-01-13 2014-12-24 从兴技术有限公司 Method and system for controlling shared memory
CN102722405B (en) * 2012-06-06 2015-05-13 新浪网技术(中国)有限公司 Counting method and system in high concurrent and multithreaded application
CN103533402B (en) * 2013-10-23 2015-08-19 腾讯科技(深圳)有限公司 Video channel management method and relevant device and communication system
CN103631869B (en) * 2013-11-05 2018-04-17 北京奇虎科技有限公司 A kind of method and apparatus for alleviating server-side database access pressure
CN103605788A (en) * 2013-12-03 2014-02-26 上海浦东物流云计算有限公司 Data processing method and system, client terminal and storage engine
CN105721388A (en) * 2014-11-30 2016-06-29 中国科学院沈阳自动化研究所 MES (Manufacturing Execution System) client data caching method and system under unstable network environment
CN105515819B (en) * 2015-07-14 2019-05-14 国家电网公司 A kind of data interface method and system of communication component and application component based on IEC61850
CN106708825B (en) * 2015-07-29 2019-09-27 腾讯科技(深圳)有限公司 A kind of data file processing method and system
CN106131556A (en) * 2016-07-19 2016-11-16 成都之达科技有限公司 Mobile unit image signal transmission method
CN108073521B (en) * 2016-11-11 2021-10-08 深圳市创梦天地科技有限公司 Data deduplication method and system
CN106790115B (en) * 2016-12-27 2019-11-05 北京天融信网络安全技术有限公司 Nginx upstream agent service system and implementation method
CN110019362B (en) * 2017-11-08 2021-08-13 中移(苏州)软件技术有限公司 Method and device for accessing database
CN108647300B (en) * 2018-05-09 2020-12-15 携程旅游信息技术(上海)有限公司 Database access intermediate system, method, device and storage medium
CN109308293B (en) * 2018-12-07 2021-09-24 广东中鹏热能科技有限公司 Database and table dividing method for large concurrent database
CN110677455B (en) * 2019-08-20 2020-11-03 北京航空航天大学 Dynamic balance account mapping method based on distributed hash

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5524202A (en) * 1991-03-01 1996-06-04 Fuji Xerox Co., Ltd. Method for forming graphic database and system utilizing the method
CN1740978A (en) * 2004-08-23 2006-03-01 华为技术有限公司 Method for realing sharing internal stored data base and internal stored data base system

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5524202A (en) * 1991-03-01 1996-06-04 Fuji Xerox Co., Ltd. Method for forming graphic database and system utilizing the method
CN1740978A (en) * 2004-08-23 2006-03-01 华为技术有限公司 Method for realing sharing internal stored data base and internal stored data base system

Also Published As

Publication number Publication date
CN101082928A (en) 2007-12-05

Similar Documents

Publication Publication Date Title
CN101082928B (en) Method for accessing database and data-base mapping system
KR102099544B1 (en) Method and device for processing distribution of streaming data
US9672272B2 (en) Method, apparatus, and computer-readable medium for efficiently performing operations on distinct data values
CN102270225B (en) Data change daily record method for supervising and data change daily record supervising device
CN103577440B (en) A kind of data processing method and device in non-relational database
CN104090897B (en) Method, server and the system of accesses meta-data
CN111898139B (en) Data reading and writing method and device and electronic equipment
CN110162512B (en) Log retrieval method, device and storage medium
CN103106218B (en) Plug-in type on-line transaction treatment system and plug-in type on-line transaction processing method
CN110209686A (en) Storage, querying method and the device of data
US11868328B2 (en) Multi-record index structure for key-value stores
CN106294423A (en) Data base divides wiring method and the device of table
CN107704475B (en) Multilayer distributed unstructured data storage method, query method and device
CN111459948B (en) Transaction integrity verification method based on centralized block chain type account book
CN102169497B (en) Method and device for managing metadata through bitmaps
CN105550220B (en) A kind of method and device of the access of heterogeneous system
CN109901991A (en) A kind of method, apparatus and electronic equipment for analyzing exception call
CN109271438A (en) A kind of data bank access method and its system
CN100487697C (en) Searching method by using modified hash method
CN116860390A (en) Data grouping method, device, equipment and medium based on data virtualization
CN101383738A (en) Internet interaction affair monitoring method and system
CN116662428A (en) Integration method, device, equipment and medium of multichannel incoming line session information data
CN112541834B (en) Identifier processing method, device and system for hydropower industry digital object
CN112182106B (en) Insurance business data processing method, system, device and storage medium
US20080270479A1 (en) System and Method for Minimization of Calculation Retrieval in a Multidimensional Database

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20230914

Address after: 518057 Tencent Building, No. 1 High-tech Zone, Nanshan District, Shenzhen City, Guangdong Province, 35 floors

Patentee after: TENCENT TECHNOLOGY (SHENZHEN) Co.,Ltd.

Patentee after: TENCENT CLOUD COMPUTING (BEIJING) Co.,Ltd.

Address before: 2, 518044, East 403 room, SEG science and Technology Park, Zhenxing Road, Shenzhen, Guangdong, Futian District

Patentee before: TENCENT TECHNOLOGY (SHENZHEN) Co.,Ltd.