CN109388654A - A kind of method and apparatus for inquiring tables of data - Google Patents
A kind of method and apparatus for inquiring tables of data Download PDFInfo
- Publication number
- CN109388654A CN109388654A CN201710659764.5A CN201710659764A CN109388654A CN 109388654 A CN109388654 A CN 109388654A CN 201710659764 A CN201710659764 A CN 201710659764A CN 109388654 A CN109388654 A CN 109388654A
- Authority
- CN
- China
- Prior art keywords
- data
- relational term
- key
- value
- tables
- 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.)
- Pending
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/50—Allocation of resources, e.g. of the central processing unit [CPU]
- G06F9/5005—Allocation of resources, e.g. of the central processing unit [CPU] to service a request
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The invention discloses a kind of method and apparatus for inquiring tables of data, are related to field of computer technology.One specific embodiment of this method includes: that the data of tables of data are saved as the relational term based on key-value pair;According to the keyword got, data corresponding with the keyword are inquired in the relational term.The embodiment can reduce system resource occupancy when inquiry tables of data.
Description
Technical field
The present invention relates to field of computer technology more particularly to a kind of method and apparatus for inquiring tables of data.
Background technique
In the database, it is usually provided with more than one tables of data, is not independent from each other between these tables of data, it is different
Tables of data between need opening relationships, and tables of data is associated according to relationship, to be inquired according to specific business need
Corresponding data.In the database, often there is the associated scene of tables of data, need to inquire the data in tables of data,
Developer is needed particularly to handle such scene, to realize that performance optimizes.
In the prior art, it generallys use and small data table is first put into the mode being associated again in memory carrys out Optimizing Queries number
According to the speed of table.
In realizing process of the present invention, at least there are the following problems in the prior art for inventor's discovery: although the prior art
Small data table is put into memory, but when being inquired there is still a need for by big data table record and small data table note
Record compares one by one, therefore the system resource for not being reduced query process substantially occupies, however it remains system resource occupies
Excessive problem.
Summary of the invention
In view of this, the embodiment of the present invention provides a kind of method and apparatus for inquiring tables of data, it can reduce inquiry data
System resource occupancy when table.
To achieve the above object, according to an aspect of an embodiment of the present invention, a kind of method for inquiring tables of data is provided,
Include:
The data of tables of data are saved as into the relational term based on key-value pair;
According to the keyword got, data corresponding with the keyword are inquired in the relational term.
Optionally, the keyword includes the associated field value and field name to be checked in tables of data, the relational term packet
Include the first relational term and the second relational term;The step of data of tables of data are saved as relational term include:
Establish the first relational term comprising field name to be checked, field value to be checked and the two corresponding relationship;
Establish the second relational term comprising associated field value, first relational term and the two corresponding relationship.
Optionally, first relational term is with the entitled key of the field to be checked, using the field value to be checked as value
Key-value pair.
Optionally, the method also includes:
In the step of according to the keyword got, data corresponding with the keyword are inquired in the relational term
Before,
Second relational term is stored in memory in the form of key-value pair;The key of the key-value pair is the associated characters
Segment value, the value of the key-value pair are first relational term.
Optionally, when second relational term to be stored in memory in the form of key-value pair, the key-value pair is
HashMap key-value pair.
Optionally, the keyword further includes data table name, and the relational term further includes third relational term;The method is also
Include:
In the step of establishing includes the second relational term of associated field value, first relational term and the two corresponding relationship
Afterwards,
Establish the third relational term comprising data table name, second relational term and the two corresponding relationship.
Optionally, the tables of data is the dimension table in data warehouse.
To achieve the above object, other side according to an embodiment of the present invention provides a kind of dress for inquiring tables of data
It sets, comprising:
Relational term module, for the data of tables of data to be saved as the relational term based on key-value pair;
Enquiry module, for being inquired in the relational term corresponding with the keyword according to the keyword got
Data.
Optionally, the keyword includes the associated field value and field name to be checked in tables of data, the relational term packet
Include the first relational term and the second relational term;The relational term module is also used to:
Establish the first relational term comprising field name to be checked, field value to be checked and the two corresponding relationship;
Establish the second relational term comprising associated field value, first relational term and the two corresponding relationship.
Optionally, first relational term is with the entitled key of the field to be checked, using the field value to be checked as value
Key-value pair.
Optionally, described device further include:
Unloading module, for second relational term to be stored in memory in the form of key-value pair;The key-value pair
Key is the associated field value, and the value of the key-value pair is first relational term.
Optionally, when second relational term to be stored in memory in the form of key-value pair, the key-value pair is
HashMap key-value pair.
Optionally, the keyword further includes data table name, and the relational term further includes third relational term;The relational term
Module is also used to:
Establish the third relational term comprising data table name, second relational term and the two corresponding relationship.
Optionally, the tables of data is the dimension table in data warehouse.
To achieve the above object, another aspect according to an embodiment of the present invention provides a kind of electricity for inquiring tables of data
Sub- equipment, comprising:
One or more processors;
Storage device, for storing one or more programs,
When one or more of programs are executed by one or more of processors, so that one or more of processing
Device is at least realized:
The data of tables of data are saved as into the relational term based on key-value pair;
According to the keyword got, data corresponding with the keyword are inquired in the relational term.
To achieve the above object, another aspect according to an embodiment of the present invention provides a kind of computer-readable medium,
On be stored with computer program, at least realized when described program is executed by processor:
The data of tables of data are saved as into the relational term based on key-value pair;
According to the keyword got, data corresponding with the keyword are inquired in the relational term.
One embodiment in foregoing invention has the following advantages that or the utility model has the advantages that because protects using by the data of tables of data
The relational term based on key-value pair is saved as, to inquire according to the key got in the relational term when inquiring tables of data
The step of technological means of corresponding data, comparison items record one by one when inquiry tables of data is omitted, and can be according to key-value pair
Corresponding relationship be directly obtained corresponding data, asked so overcoming existing querying method system resource and occupying excessive technology
Topic, and then reach the technical effect of system resource occupancy when reducing inquiry tables of data.
Further effect possessed by above-mentioned non-usual optional way adds hereinafter in conjunction with specific embodiment
With explanation.
Detailed description of the invention
Attached drawing for a better understanding of the present invention, does not constitute an undue limitation on the present invention.Wherein:
Fig. 1 is the schematic diagram of the key step of the method for inquiry tables of data according to an embodiment of the present invention;
Fig. 2 is the storage state signal of relational term in memory in the method for inquiry tables of data according to an embodiment of the present invention
Figure;
Fig. 3 is the schematic diagram of the main modular of the device of inquiry tables of data according to an embodiment of the present invention;
Fig. 4 is that the embodiment of the present invention can be applied to exemplary system architecture figure therein;
Fig. 5 is adapted for the structural representation of the computer system for the terminal device or server of realizing the embodiment of the present invention
Figure.
Specific embodiment
Below in conjunction with attached drawing, an exemplary embodiment of the present invention will be described, including the various of the embodiment of the present invention
Details should think them only exemplary to help understanding.Therefore, those of ordinary skill in the art should recognize
It arrives, it can be with various changes and modifications are made to the embodiments described herein, without departing from scope and spirit of the present invention.Together
Sample, for clarity and conciseness, descriptions of well-known functions and structures are omitted from the following description.
Fig. 1 is the schematic diagram of the key step of the method for inquiry tables of data according to an embodiment of the present invention.
As shown in Figure 1, a kind of method of the inquiry tables of data provided according to embodiments of the present invention, comprising:
The data of tables of data are saved as the relational term based on key-value pair by S10.Usual tables of data include multiple fields and
A plurality of record, one of field are associate field, i.e., mutually map in inquiry for the record with other tables of data
Field;A part of field in other fields or other fields is field to be checked, for storing target data to be checked.This
Step is converted on the basis of keeping each item record in tables of data, original corresponding relationship between each field name, field value
It for the relational term based on key-value pair, such as with the entitled key of field to be checked, field value to be checked is that value establishes key-value pair etc..It is preferred that
, the key-value pair is HashMap type key-value pair.
S11 inquires data corresponding with the keyword according to the keyword got in the relational term.It is obtaining
After getting keyword, using keyword as the key of key-value pair in the relational term, corresponding value can be got, so as to fast
Data to be checked are obtained fastly without being compared the content of keyword and tables of data one by one.
Such as have the first tables of data and the second tables of data, the content according to the first tables of data is needed, in the second tables of data
Corresponding content is inquired, the query process based on the prior art is substantially are as follows: a certain field is selected from the first tables of data, by every
The field value of the value and the associate field of the second tables of data every record that record the field compares one by one, if meeting preset matching
Relationship (usual matching relationship refers to that the two is identical), it is determined that the corresponding record in the second tables of data has been inquired, it can be further
Obtain the data of the field to be checked in the record.It, can will be in the second tables of data and according to method provided in this embodiment
Associated field value, field name to be checked and field value to be checked save as the relational term based on key-value pair, can be straight in inquiry
It connects and answers Relation acquisition to corresponding data according to the key-value pair in key-value pair, each item without comparing the second tables of data one by one is remembered
Record, to reduce the time-consuming of inquiry data.
For the database that is mutually related in tables of data by external key, the embodiment of the present invention is more applicable for counting
According to the database for the corresponding relationship that the corresponding relationship between table is more fuzzy or does not determine, such as data warehouse etc..
From the above it can be seen that method provided in this embodiment using the data of tables of data are saved as because be based on
The relational term of key-value pair, to inquire corresponding data in the relational term according to the key got when inquiring tables of data
Technological means, when being omitted inquiry tables of data one by one comparison every record the step of, and can be closed according to the corresponding of key-value pair
System is directly obtained corresponding data, so overcoming existing querying method system resource occupies excessive technical problem, in turn
Reach the technical effect of system resource occupancy when reducing inquiry tables of data.
In some alternative embodiments, the keyword includes the associated field value in tables of data and field to be checked
Name, the relational term include the first relational term and the second relational term;S10, the step of data of tables of data are saved as into relational term
Include:
Establish the first relational term comprising field name to be checked, field value to be checked and the two corresponding relationship.Optionally, institute
To state the first relational term be with the entitled key of the field to be checked, with the field value to be checked be value key-value pair.
Establish the second relational term comprising associated field value, first relational term and the two corresponding relationship.
The present embodiment establishes two groups of nested relational terms, wherein the first relational term is preferably with the field name to be checked
It is the key-value pair of value for key, with the field value to be checked;Second relational term is then used to record associated field value and described first
The corresponding relationship of relational term.After getting the keyword comprising associated field value and field name to be checked, so that it may second
Corresponding first relational term is obtained according to associated field value in relational term, is then further closed according to field name to be checked first
Corresponding field value to be checked is got in set entry, completes query process.
The form of second relational term can be optional in order to further increase inquiry velocity for key-value pair or tables of data etc.
, in S11, according to the keyword got, before the step of data corresponding with the keyword are inquired in the relational term,
Second relational term is stored in memory in the form of key-value pair;The key of the key-value pair is the associated field value, institute
The value for stating key-value pair is first relational term.The key-value pair is preferably HashMap key-value pair.By the second relational term store to
In memory, since the access speed of memory is higher than the magnetic-based storage media (such as hard disk) in database, help to improve
Inquire the speed of data.
The realization of Map interface of the HashMap based on Hash table exists in the form of key-value (key-value).?
In HashMap, key-value can always be handled as entirety, and system can calculate key- according to hash algorithm
The storage location of value, therefore value can rapidly be deposited, withdrawed by key.Therefore, the second relational term is stored as
HashMap key-value pair can also further increase inquiry velocity, and when storage can make the associated field value in the second relational term
For the key of HashMap key-value pair, using the first relational term as the value of HashMap key-value pair.
When needing to inquire multiple tables of data, need to distinguish the data in multiple tables of data.Based on this
Purpose, in some alternative embodiments, the keyword further include data table name, and the relational term further includes third relationship
?;The method also includes:
In the step of establishing includes the second relational term of associated field value, first relational term and the two corresponding relationship
Afterwards,
Establish the third relational term comprising data table name, second relational term and the two corresponding relationship.Third relational term
Form can for key-value pair or tables of data etc., when third relational term is key-value pair, can using tables of data name as key, with
Second relational term is as value.
Querying method described in the present embodiment is further illustrated based on the embodiment of concrete scene below by one
Concrete application mode.
The database environment that the present embodiment is based on is data warehouse hive;As based on distributed system infrastructure
A Tool for Data Warehouse of Hadoop, hive supports the data file of structuring being mapped as a database table, and provides
Simple sql (Structured Query Language, structured query language) query function.
Tables of data in Hive includes the fact that table and dimension table.True table be for storage service trunk content, can be with
It is interpreted as containing the every terms of information of business, therefore usually capacity is very big;Dimension table then can be understood as through a certain specific angle
(dimension) observed traffic is spent, usually only can be divided into a kind of attribute comprising some in business, therefore capacity is smaller.And in order into
One step obtains more comprehensive business information, often will appear the scene that true table and dimension table are associated, thus need into
The optimization of row performance.
Optimization method in the prior art, by adjusting the grammer of hive sql or the attribute of setting hive, Lai Shixian
It is inquired again after dimension table is loaded onto memory.But the principle of inquiry is still being associated with according to true table and dimension table
Field compares each record in dimension table one by one, therefore occupied system resource is simultaneously when execution query task
Do not reduce.
Illustrate the implementation when method of the inquiry tables of data in the present invention is applied to hive below.
1. establishing partition table
Firstly, establishing a partition table.Preferably, each fact table corresponds to a partition table, each of partition table
Subregion stores the data for having a dimension table corresponding with the fact table.Each field of partition table is as shown in table 1:
1 partition table explanation of field of table
Indicate: the data of dimension table are first inserted into corresponding subregion in partition table by needs, wherein need to close in dimension table
Value of the field of connection as mapping_id field in dimension table;After relevant dimension table, field to be checked is entitled in dimension table
The key (key) of map type key-value pair in mapping_column, the value of field to be checked are map type key in mapping_column
The value (value) of value pair;Mapping_type field is stored with the title of dimension table, i.e. the value of mapping_type field is identical
Each record belong to the same subregion in partition table.
The type of mapping_column is map type (such as HashMap), if there is multiple fields will access, is only needed
The case where in map data structure increasing a key-value more, therefore supporting multiple fields to be checked.Such as thing
There is field A in real table, there is field A/B/C in dimension table, is associated by field A, field B and C to be checked, it is only necessary to B
It is all stored in mapping_column with C.Such as have dimension table " city " as shown in table 2:
2 dimension table city of table
city_id | city_name | city_size |
1 | beijing | 1000 |
2 | tianjin | 900 |
It can be seen that including 3 fields in dimension table city, 2 records are shared.If using city_id field as associated characters
Section, city_name and city_size field is as field to be checked, then the dimension table corresponding subregion such as table 3 in partition table
It is shown:
Subregion of the 3 dimension table city of table in partition table
mapping_id | mapping_column | mapping_type |
1 | {‘city_name’:’beijing’,’city_size’:1000} | city |
2 | {‘city_name’:’tianjin’,’city_size’:900} | city |
It should be noted that the practical key for shoulding be map type of data saved in mapping_column field in table 3
Value pair, for sake of clarity, therefore is embodied in the form of common key-value pair in table 3, and it is real for being not construed as table 3
The partition content on border.
2. writing user-defined function
UDF (user defined function is used for custom function) is the spread function content that hive is provided, when
When the built-in function that Hive is provided is unable to satisfy business processing and needs, it may be considered that use User-Defined Functions.In partition table
After foundation, following query steps are realized by writing UDF:
Step 1, the keyword for inquiring data is obtained.Keyword includes dimension table name, associated field value and to be checked
Field name is needed according to the field to be checked in the corresponding dimension table of keyword query, where specified associations field value in record
Value.When writing UDF, the keyword obtained can will be needed as the parameter of function.
Step 2, according to the dimension table name in keyword, subregion corresponding with the dimension table in partition table is read using file stream
Under data to HashMap<String, Map>in.Wherein the key of HashMap is the value of mapping_id field in partition table,
The value of HashMap is the map data structure of mapping_column field in partition table.As it can be seen that step S20 is by partition table
Content read into memory, and save as the form of HashMap, that is, establish the key assignments relationship of two levels.
Fig. 2 is the storage state signal of relational term in memory in the method for inquiry tables of data according to an embodiment of the present invention
Figure.
As shown in Fig. 2, in the present embodiment, after the content in city subregion shown in table 2 is read in memory, being formed to divide
HashMap type number of the value of mapping_id field as key, using the value of mapping_column field as value in area
According to;Meanwhile the value of hashmap1 is with field name city_name and the city_size to be checked difference in former dimension table again
As key, HashMap type data using the value of the two fields as value, thus by the data in dimension table with nested
The form of HashMap type key-value pair is stored in memory.
Step 3, it according to the associated field value in keyword, is obtained from HashMap using the associated field value as key
When, the value of the mapping_column field in corresponding value.Since HashMap has the characteristics of quick access, step
The time-consuming that S22 is executed is seldom, time-consuming far below the inquiry of routine data table, can save a large amount of time.
Step 4, according to the field name to be checked in keyword, from the map data structure in mapping_column
When to using the field name to be checked as key, the value in corresponding value is as the data and return finally inquired.
When executing step 1 to step 4, corresponding function can be write according to existing development language and be realized, only
Corresponding keyword is transmitted, i.e., dimension table name, associated field value and field name to be checked are as parameter.Referring still to figure
Shown in 2, such as need to obtain city_name when city_id is " 1 ", it can be with Transfer Parameters: (' city ', 1, ' city_
Name '), by function execute by dimension table city correspond in partition table subregion data reading memory in, then respectively with
Associated field value " 1 " and field name city_name to be checked are to be retrieved in the HashMap type data of key in memory, i.e.,
Value corresponding to city_name " beijing " can be obtained.
It can be seen that the present embodiment according to step 1-4 to be loaded into memory data corresponding in partition table according to subregion,
And it is each in true table (big table) with the form of key-value there are in HashMap, therefore when executing hive sql
Item record only needs a key from memory according to transmitting to go to search value, does not need to start additional system task and comes and dimension
Table (small table), which is associated, can be obtained by associated data.Due to association process be searched in memory according to key, and
It is not to match line by line, so associated efficiency greatly improves;Due to not needing to start additional system task, compare in hive certainly
The inquiry mode of band saves cluster resource.
3. system environments is added in User-Defined Functions
After creation finishes UDF, need to be uploaded to system ring after function is further packaged (such as being packaged as jar file)
In border.When in use, it can be called by way of creating interim function, and pass through the incoming key of the parameter of interim function
Word, to realize the inquiry to tables of data.
Fig. 3 is the schematic diagram of the main modular of the device of inquiry tables of data according to an embodiment of the present invention.
As shown, including: according to the device 300 of inquiry tables of data provided in this embodiment
Relational term module 301, for the data of tables of data to be saved as the relational term based on key-value pair;
Enquiry module 302, for being inquired in the relational term corresponding with the keyword according to the keyword got
Data.
In some alternative embodiments, the keyword includes the associated field value in tables of data and field to be checked
Name, the relational term include the first relational term and the second relational term;The relational term module 301 is also used to:
Establish the first relational term comprising field name to be checked, field value to be checked and the two corresponding relationship;
Establish the second relational term comprising associated field value, first relational term and the two corresponding relationship.
In some alternative embodiments, first relational term be with the entitled key of the field to be checked, with it is described to
Inquiry field value is the key-value pair of value.
In some alternative embodiments, described device 300 further include:
Unloading module 303, for second relational term to be stored in memory in the form of key-value pair;The key-value pair
Key be the associated field value, the value of the key-value pair is first relational term.
In some alternative embodiments, when second relational term to be stored in memory in the form of key-value pair,
The key-value pair is HashMap key-value pair.
In some alternative embodiments, the keyword further includes data table name, and the relational term further includes that third is closed
Set entry;The relational term module 301 is also used to:
Establish the third relational term comprising data table name, second relational term and the two corresponding relationship.
In some alternative embodiments, the tables of data is the dimension table in data warehouse.
From the above it can be seen that device provided in this embodiment using the data of tables of data are saved as because be based on
The relational term of key-value pair, to inquire corresponding data in the relational term according to the key got when inquiring tables of data
Technological means, when being omitted inquiry tables of data one by one comparison every record the step of, and can be closed according to the corresponding of key-value pair
System is directly obtained corresponding data, so overcoming existing querying method system resource occupies excessive technical problem, in turn
Reach the technical effect of system resource occupancy when reducing inquiry tables of data.
Fig. 4 is shown can showing using the device of the method or inquiry tables of data of the inquiry tables of data of the embodiment of the present invention
Example property system architecture 400.
As shown in figure 4, system architecture 400 may include terminal device 401,402,403, network 404 and server 405.
Network 404 between terminal device 401,402,403 and server 405 to provide the medium of communication link.Network 404 can be with
Including various connection types, such as wired, wireless communication link or fiber optic cables etc..
User can be used terminal device 401,402,403 and be interacted by network 404 with server 405, to receive or send out
Send message etc..Various telecommunication customer end applications, such as the application of shopping class, net can be installed on terminal device 401,402,403
(merely illustrative) such as the application of page browsing device, searching class application, instant messaging tools, mailbox client, social platform softwares.
Terminal device 401,402,403 can be the various electronic equipments with display screen and supported web page browsing, packet
Include but be not limited to smart phone, tablet computer, pocket computer on knee and desktop computer etc..
Server 405 can be to provide the server of various services, such as utilize terminal device 401,402,403 to user
The data server supported is provided when executing data query.
It should be noted that the method for inquiry tables of data provided by the embodiment of the present invention is generally executed by server 405,
Correspondingly, the device for inquiring tables of data is generally positioned in server 405.
It should be understood that the number of terminal device, network and server in Fig. 4 is only schematical.According to realization need
It wants, can have any number of terminal device, network and server.
According to an embodiment of the invention, the present invention also provides a kind of electronic equipment and a kind of readable storage medium storing program for executing.
Fig. 5 is adapted for the structural representation of the computer system for the terminal device or server of realizing the embodiment of the present invention
Figure.
Below with reference to Fig. 5, it illustrates the computer systems 500 for the terminal device for being suitable for being used to realize the embodiment of the present invention
Structural schematic diagram.Terminal device shown in Fig. 5 is only an example, function to the embodiment of the present invention and should not use model
Shroud carrys out any restrictions.
As shown in figure 5, computer system 500 includes central processing unit (CPU) 501, it can be read-only according to being stored in
Program in memory (ROM) 502 or be loaded into the program in random access storage device (RAM) 503 from storage section 508 and
Execute various movements appropriate and processing.In RAM 503, also it is stored with system 500 and operates required various programs and data.
CPU 501, ROM 502 and RAM 503 are connected with each other by bus 504.Input/output (I/O) interface 505 is also connected to always
Line 504.
I/O interface 505 is connected to lower component: the importation 506 including keyboard, mouse etc.;It is penetrated including such as cathode
The output par, c 507 of spool (CRT), liquid crystal display (LCD) etc. and loudspeaker etc.;Storage section 508 including hard disk etc.;
And the communications portion 509 of the network interface card including LAN card, modem etc..Communications portion 509 via such as because
The network of spy's net executes communication process.Driver 510 is also connected to I/O interface 505 as needed.Detachable media 511, such as
Disk, CD, magneto-optic disk, semiconductor memory etc. are mounted on as needed on driver 510, in order to read from thereon
Computer program be mounted into storage section 508 as needed.
Particularly, according to an embodiment of the invention, the process of the schematic diagram description of key step may be implemented as above
Computer software programs.For example, the embodiment of the present invention includes a kind of computer program product comprising being carried on computer can
The computer program on medium is read, which includes the program for executing method shown in the schematic diagram of key step
Code.In such embodiments, which can be downloaded and installed from network by communications portion 509, and/
Or it is mounted from detachable media 511.When the computer program is executed by central processing unit (CPU) 501, the present invention is executed
System in the above-mentioned function that limits.
It should be noted that computer-readable medium shown in the present invention can be computer-readable signal media or meter
Calculation machine readable storage medium storing program for executing either the two any combination.Computer readable storage medium for example can be --- but not
Be limited to --- electricity, magnetic, optical, electromagnetic, infrared ray or semiconductor system, device or device, or any above combination.Meter
The more specific example of calculation machine readable storage medium storing program for executing can include but is not limited to: have the electrical connection, just of one or more conducting wires
Taking formula computer disk, hard disk, random access storage device (RAM), read-only memory (ROM), erasable type may be programmed read-only storage
Device (EPROM or flash memory), optical fiber, portable compact disc read-only memory (CD-ROM), light storage device, magnetic memory device,
Or above-mentioned any appropriate combination.In the present invention, computer readable storage medium can be it is any include or storage journey
The tangible medium of sequence, the program can be commanded execution system, device or device use or in connection.And at this
In invention, computer-readable signal media may include in a base band or as carrier wave a part propagate data-signal,
Wherein carry computer-readable program code.The data-signal of this propagation can take various forms, including but unlimited
In electromagnetic signal, optical signal or above-mentioned any appropriate combination.Computer-readable signal media can also be that computer can
Any computer-readable medium other than storage medium is read, which can send, propagates or transmit and be used for
By the use of instruction execution system, device or device or program in connection.Include on computer-readable medium
Program code can transmit with any suitable medium, including but not limited to: wireless, electric wire, optical cable, RF etc. are above-mentioned
Any appropriate combination.
Flow chart and block diagram in attached drawing are illustrated according to the system of various embodiments of the invention, method and computer journey
The architecture, function and operation in the cards of sequence product.In this regard, each box in flowchart or block diagram can generation
A part of one module, program segment or code of table, a part of above-mentioned module, program segment or code include one or more
Executable instruction for implementing the specified logical function.It should also be noted that in some implementations as replacements, institute in box
The function of mark can also occur in a different order than that indicated in the drawings.For example, two boxes succeedingly indicated are practical
On can be basically executed in parallel, they can also be executed in the opposite order sometimes, and this depends on the function involved.Also it wants
It is noted that the combination of each box in block diagram or flow chart and the box in block diagram or flow chart, can use and execute rule
The dedicated hardware based systems of fixed functions or operations is realized, or can use the group of specialized hardware and computer instruction
It closes to realize.
Being described in module involved in the embodiment of the present invention can be realized by way of software, can also be by hard
The mode of part is realized.Described module also can be set in the processor, for example, can be described as: a kind of processor packet
Include relational term module 301 and enquiry module 302.Wherein, the title of these modules is not constituted under certain conditions to the module
The restriction of itself, for example, relational term module 301 is also described as " for saving as the data of tables of data based on key assignments
Pair relational term module ".
As on the other hand, the present invention also provides a kind of computer-readable medium, which be can be
Included in equipment described in above-described embodiment;It is also possible to individualism, and without in the supplying equipment.Above-mentioned calculating
Machine readable medium carries one or more program, when said one or multiple programs are executed by the equipment, makes
Obtaining the equipment includes:
The data of tables of data are saved as into the relational term based on key-value pair;
According to the keyword got, data corresponding with the keyword are inquired in the relational term.
Technical solution according to an embodiment of the present invention, because saving as the pass based on key-value pair using by the data of tables of data
Set entry, so as to crucial in the technology hand for inquiring corresponding data in the relational term according to what is got when inquiring tables of data
The step of section, comparison items record one by one when inquiry tables of data is omitted, and can directly be obtained according to the corresponding relationship of key-value pair
Corresponding data is got, so overcoming existing querying method system resource occupies excessive technical problem, and then reaches reduction
The technical effect of system resource occupancy when inquiry tables of data.
Above-mentioned specific embodiment, does not constitute a limitation on the scope of protection of the present invention.Those skilled in the art should be bright
It is white, design requirement and other factors are depended on, various modifications, combination, sub-portfolio and substitution can occur.It is any
Made modifications, equivalent substitutions and improvements etc. within the spirit and principles in the present invention, should be included in the scope of the present invention
Within.
Claims (16)
1. a kind of method for inquiring tables of data characterized by comprising
The data of tables of data are saved as into the relational term based on key-value pair;
According to the keyword got, data corresponding with the keyword are inquired in the relational term.
2. the method according to claim 1, wherein the keyword include associated field value in tables of data and
Field name to be checked, the relational term include the first relational term and the second relational term;The data of tables of data are saved as into relational term
The step of include:
Establish the first relational term comprising field name to be checked, field value to be checked and the two corresponding relationship;
Establish the second relational term comprising associated field value, first relational term and the two corresponding relationship.
3. according to the method described in claim 2, it is characterized in that, first relational term is entitled with the field to be checked
Key, with the field value to be checked be value key-value pair.
4. according to the method described in claim 2, it is characterized in that, the method also includes:
The step of according to the keyword got, data corresponding with the keyword are inquired in the relational term before,
Second relational term is stored in memory in the form of key-value pair;The key of the key-value pair is the associate field
Value, the value of the key-value pair are first relational term.
5. according to the method described in claim 4, it is characterized in that, being stored in the form of key-value pair by second relational term
When into memory, the key-value pair is HashMap key-value pair.
6. according to the method described in claim 2, it is characterized in that, the keyword further includes data table name, the relational term
It further include third relational term;The method also includes:
After the step of establishing includes the second relational term of associated field value, first relational term and the two corresponding relationship,
Establish the third relational term comprising data table name, second relational term and the two corresponding relationship.
7. -6 any method according to claim 1, which is characterized in that the tables of data is the dimension in data warehouse
Table.
8. a kind of device for inquiring tables of data characterized by comprising
Relational term module, for the data of tables of data to be saved as the relational term based on key-value pair;
Enquiry module, for inquiring data corresponding with the keyword in the relational term according to the keyword got.
9. device according to claim 8, which is characterized in that the keyword include associated field value in tables of data and
Field name to be checked, the relational term include the first relational term and the second relational term;The relational term module is also used to:
Establish the first relational term comprising field name to be checked, field value to be checked and the two corresponding relationship;
Establish the second relational term comprising associated field value, first relational term and the two corresponding relationship.
10. device according to claim 9, which is characterized in that first relational term is with the field name to be checked
It is the key-value pair of value for key, with the field value to be checked.
11. device according to claim 9, which is characterized in that described device further include:
Unloading module, for second relational term to be stored in memory in the form of key-value pair;The key of the key-value pair is
The associated field value, the value of the key-value pair are first relational term.
12. device according to claim 11, which is characterized in that deposited in the form of key-value pair by second relational term
When storage is into memory, the key-value pair is HashMap key-value pair.
13. device according to claim 9, which is characterized in that the keyword further includes data table name, the relational term
It further include third relational term;The relational term module is also used to:
Establish the third relational term comprising data table name, second relational term and the two corresponding relationship.
14. according to any device of claim 8-13, which is characterized in that the tables of data is the dimension in data warehouse
Table.
15. a kind of electronic equipment for inquiring tables of data characterized by comprising
One or more processors;
Storage device, for storing one or more programs,
When one or more of programs are executed by one or more of processors, so that one or more of processors are real
The now method as described in any in claim 1-7.
16. a kind of computer-readable medium, is stored thereon with computer program, which is characterized in that described program is held by processor
The method as described in any in claim 1-7 is realized when row.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710659764.5A CN109388654A (en) | 2017-08-04 | 2017-08-04 | A kind of method and apparatus for inquiring tables of data |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710659764.5A CN109388654A (en) | 2017-08-04 | 2017-08-04 | A kind of method and apparatus for inquiring tables of data |
Publications (1)
Publication Number | Publication Date |
---|---|
CN109388654A true CN109388654A (en) | 2019-02-26 |
Family
ID=65413329
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201710659764.5A Pending CN109388654A (en) | 2017-08-04 | 2017-08-04 | A kind of method and apparatus for inquiring tables of data |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109388654A (en) |
Cited By (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110109924A (en) * | 2019-04-23 | 2019-08-09 | 重庆紫光华山智安科技有限公司 | Search method and device |
CN110175174A (en) * | 2019-05-24 | 2019-08-27 | 广州市百果园信息技术有限公司 | A kind of data query method, apparatus, equipment and storage medium |
CN110837508A (en) * | 2019-11-08 | 2020-02-25 | 深圳市彬讯科技有限公司 | Method, device and equipment for establishing aperture system and computer storage medium |
CN110837365A (en) * | 2019-11-08 | 2020-02-25 | 深圳市彬讯科技有限公司 | Script aided design method and device based on root table |
CN111209296A (en) * | 2019-12-31 | 2020-05-29 | 航天信息股份有限公司企业服务分公司 | Database access method and device, electronic equipment and storage medium |
CN111274051A (en) * | 2020-01-19 | 2020-06-12 | 中信银行股份有限公司 | Data processing method and device, electronic equipment and computer readable storage medium |
CN111967702A (en) * | 2019-05-20 | 2020-11-20 | 阿里巴巴集团控股有限公司 | Data processing method and system |
CN112487111A (en) * | 2020-12-16 | 2021-03-12 | 江苏苏宁云计算有限公司 | Data table association method and device based on KV database |
CN112905622A (en) * | 2021-01-26 | 2021-06-04 | 广州海量数据库技术有限公司 | Data query method and device |
CN113111084A (en) * | 2021-03-31 | 2021-07-13 | 北京沃东天骏信息技术有限公司 | Method and device for processing data |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104392001A (en) * | 2014-12-15 | 2015-03-04 | 北京国双科技有限公司 | Database inquiry method and device |
CN104794130A (en) * | 2014-01-20 | 2015-07-22 | 华为技术有限公司 | Inter-table correlation query method and device |
CN106294792A (en) * | 2016-08-15 | 2017-01-04 | 上海携程商务有限公司 | The method for building up of correlation inquiry system and set up system |
CN106326245A (en) * | 2015-06-19 | 2017-01-11 | 北京京东尚科信息技术有限公司 | Hive data warehouse-based fast association realization method and device |
CN106503040A (en) * | 2016-09-20 | 2017-03-15 | 福建天晴数码有限公司 | It is suitable for KV data bases and its creation method of SQL query method |
US20170193041A1 (en) * | 2016-01-05 | 2017-07-06 | Sqrrl Data, Inc. | Document-partitioned secondary indexes in a sorted, distributed key/value data store |
-
2017
- 2017-08-04 CN CN201710659764.5A patent/CN109388654A/en active Pending
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104794130A (en) * | 2014-01-20 | 2015-07-22 | 华为技术有限公司 | Inter-table correlation query method and device |
CN104392001A (en) * | 2014-12-15 | 2015-03-04 | 北京国双科技有限公司 | Database inquiry method and device |
CN106326245A (en) * | 2015-06-19 | 2017-01-11 | 北京京东尚科信息技术有限公司 | Hive data warehouse-based fast association realization method and device |
US20170193041A1 (en) * | 2016-01-05 | 2017-07-06 | Sqrrl Data, Inc. | Document-partitioned secondary indexes in a sorted, distributed key/value data store |
CN106294792A (en) * | 2016-08-15 | 2017-01-04 | 上海携程商务有限公司 | The method for building up of correlation inquiry system and set up system |
CN106503040A (en) * | 2016-09-20 | 2017-03-15 | 福建天晴数码有限公司 | It is suitable for KV data bases and its creation method of SQL query method |
Cited By (12)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110109924A (en) * | 2019-04-23 | 2019-08-09 | 重庆紫光华山智安科技有限公司 | Search method and device |
CN111967702A (en) * | 2019-05-20 | 2020-11-20 | 阿里巴巴集团控股有限公司 | Data processing method and system |
CN110175174A (en) * | 2019-05-24 | 2019-08-27 | 广州市百果园信息技术有限公司 | A kind of data query method, apparatus, equipment and storage medium |
CN110837508A (en) * | 2019-11-08 | 2020-02-25 | 深圳市彬讯科技有限公司 | Method, device and equipment for establishing aperture system and computer storage medium |
CN110837365A (en) * | 2019-11-08 | 2020-02-25 | 深圳市彬讯科技有限公司 | Script aided design method and device based on root table |
CN111209296A (en) * | 2019-12-31 | 2020-05-29 | 航天信息股份有限公司企业服务分公司 | Database access method and device, electronic equipment and storage medium |
CN111274051A (en) * | 2020-01-19 | 2020-06-12 | 中信银行股份有限公司 | Data processing method and device, electronic equipment and computer readable storage medium |
CN111274051B (en) * | 2020-01-19 | 2023-08-22 | 中信银行股份有限公司 | Data processing method and device, electronic equipment and computer readable storage medium |
CN112487111A (en) * | 2020-12-16 | 2021-03-12 | 江苏苏宁云计算有限公司 | Data table association method and device based on KV database |
CN112905622A (en) * | 2021-01-26 | 2021-06-04 | 广州海量数据库技术有限公司 | Data query method and device |
CN113111084A (en) * | 2021-03-31 | 2021-07-13 | 北京沃东天骏信息技术有限公司 | Method and device for processing data |
CN113111084B (en) * | 2021-03-31 | 2024-06-18 | 北京沃东天骏信息技术有限公司 | Method and device for processing data |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109388654A (en) | A kind of method and apparatus for inquiring tables of data | |
CN106326381B (en) | HBase data retrieval method based on MapDB building | |
CN109614402B (en) | Multidimensional data query method and device | |
CN110019080B (en) | Data access method and device | |
CN109413127A (en) | A kind of method of data synchronization and device | |
CN109409119A (en) | Data manipulation method and device | |
CN111695840B (en) | Method and device for realizing flow control | |
CN110209677A (en) | The method and apparatus of more new data | |
CN110427438A (en) | Data processing method and its device, electronic equipment and medium | |
CN110348771A (en) | The method and apparatus that a kind of pair of order carries out group list | |
CN110069579A (en) | Fence method of partition and device | |
CN110471848A (en) | A kind of method and apparatus of dynamic returned packet | |
CN107480205A (en) | A kind of method and apparatus for carrying out data partition | |
CN110389812A (en) | For managing the method, equipment and computer readable storage medium of virtual machine | |
CN109753504A (en) | Data query method and device | |
CN110019310A (en) | Data processing method and system, computer system, computer readable storage medium | |
CN110309142A (en) | The method and apparatus of regulation management | |
CN108959294A (en) | A kind of method and apparatus accessing search engine | |
CN111401684A (en) | Task processing method and device | |
CN104408183A (en) | Data import method and device of data system | |
CN110109912A (en) | A kind of identifier generation method and device | |
CN110399397A (en) | A kind of data query method and system | |
CN110704481A (en) | Method and device for displaying data | |
CN110020271A (en) | Method and system for cache management | |
EP4216076A1 (en) | Method and apparatus of processing an observation information, electronic device and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20190226 |
|
RJ01 | Rejection of invention patent application after publication |