CN110110211A - Data query method and apparatus based on universal model - Google Patents

Data query method and apparatus based on universal model Download PDF

Info

Publication number
CN110110211A
CN110110211A CN201810058806.4A CN201810058806A CN110110211A CN 110110211 A CN110110211 A CN 110110211A CN 201810058806 A CN201810058806 A CN 201810058806A CN 110110211 A CN110110211 A CN 110110211A
Authority
CN
China
Prior art keywords
field
data
model
querying condition
heavy
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
Application number
CN201810058806.4A
Other languages
Chinese (zh)
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.)
Beijing Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke Information Technology Co Ltd
Original Assignee
Beijing Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke Information Technology 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 Beijing Jingdong Century Trading Co Ltd, Beijing Jingdong Shangke Information Technology Co Ltd filed Critical Beijing Jingdong Century Trading Co Ltd
Priority to CN201810058806.4A priority Critical patent/CN110110211A/en
Publication of CN110110211A publication Critical patent/CN110110211A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/242Query formulation
    • G06F16/2433Query languages
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Computational Linguistics (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Mathematical Physics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The data query method and apparatus based on universal model that the invention discloses a kind of, are related to field of computer technology.One specific embodiment of this method includes: to determine non-heavy field from the field of multiple data models for corresponding to different inquiry scenes;Wherein, the field of each data model in the multiple data model includes: querying condition field and precomputation result field;Establish universal model using the non-heavy field, and by the multiple data model querying condition field data and precomputation result field data according to the non-heavy field be stored in the universal model;In response to the query statement of the different inquiry scenes, the corresponding query result data of the query statement are chosen from the precomputation result field data that the universal model stores and are returned.The embodiment can reduce data model quantity under the premise of not influencing search efficiency, to reduce database maintenance cost and the front and back end degree of coupling.

Description

Data query method and apparatus based on universal model
Technical field
The present invention relates to field of computer technology more particularly to a kind of data query methods and dress based on universal model It sets.
Background technique
In data application field, a large amount of different inquiry scenes are usually contained, each inquiry scene both corresponds to one and looks into Ask sentence such as structured query language SQL (Structured Query Language) sentence.In practical application, in order to reduce Query responding time improves user experience, precomputation can be carried out to the possible query result of user, and be directed to each inquiry scene A data model is established to save the result data after precomputation.Meanwhile being continuously increased with data volume, need basis to look into The difference for asking scene creates index in the reasonable field of data model to accelerate inquiry velocity.
In the implementation of the present invention, the inventor finds that the existing technology has at least the following problems:
Data model and index are established for each most fine-grained inquiry scene 1. in the prior art, generally requiring, Therefore a large amount of data model and index are generated, brings the maintenance cost of great number.
2. a large amount of indexes in the prior art can seriously affect the write performance of database, data are caused to update slack-off.
3. since mass data model exists in the prior art, so that front-end functionality code needs to be embedded in a large amount of inquiry language Sentence.Moreover, code revision amount is larger in front end applications modification, the development progress for relying on rear end model is also needed, so that front and back end The degree of coupling is higher, system whole development time and joint debugging time are longer.
Summary of the invention
In view of this, the embodiment of the present invention provides a kind of data query method and apparatus based on universal model, Neng Gou It does not influence to reduce data model quantity under the premise of search efficiency, to reduce database maintenance cost and the front and back end degree of coupling.
To achieve the above object, according to an aspect of the invention, there is provided a kind of data query based on universal model Method.
The data query method based on universal model of the embodiment of the present invention includes: from corresponding to the more of different inquiry scenes Non- heavy field is determined in the field of a data model;Wherein, the field packet of each data model in the multiple data model It includes: querying condition field and precomputation result field;Universal model is established using the non-heavy field, and by the multiple data Querying condition field data and precomputation result field data in model are stored in the Universal Die according to the non-heavy field Type;And the query statement in response to the different inquiry scenes, the precomputation result word stored from the universal model The corresponding query result data of the query statement are chosen in segment data to return.
Optionally, the querying condition field data and precomputation result field data by the multiple data model Being stored in the universal model according to the non-heavy field includes: any record for any data model: keeping it at this The querying condition field of data model and the value of precomputation result field, using preset non-inquiry mark value as it described logical The modified record is stored in the Universal Die according to the non-heavy field by the value for increasing querying condition field newly with model Type;Wherein, the newly-increased querying condition field are as follows: in the non-heavy field in addition to the querying condition field of the data model Querying condition field.
Optionally, the method further includes: by querying condition field data in the multiple data model and pre- After calculated result field data is stored in the universal model according to the non-heavy field, from the multiple data model Non- heavy index field is determined in index field, is the non-heavy index field creation index in the universal model.
Optionally, described to choose the inquiry language from the precomputation result field data that the universal model stores It includes: the benefit in the precomputation result field data of universal model storage that the corresponding query result data of sentence, which return, The corresponding query result data of the query statement are chosen used in the index of universal model creation to return.
Optionally, for the query statement in either query scene in the different inquiry scenes, querying condition clause It include: the value of the querying condition field of the data model corresponding to the inquiry scene and the newly-increased inquiry item of the data model The non-inquiry mark value of part field;Wherein, the newly-increased querying condition field of the data model are as follows: the number is removed in the non-heavy field According to the querying condition field except the querying condition field of model.
Optionally, the multiple data model and the universal model are tables of data, and the query statement is structuring Query language SQL statement, the querying condition clause are WHERE clause.
To achieve the above object, according to another aspect of the invention, a kind of data query based on universal model is provided Device.
The data query device based on universal model of the embodiment of the present invention can include: duplicate removal unit can be used for from correspondence Non- heavy field is determined in the field of multiple data models of different inquiry scenes;Wherein, every in the multiple data model The field of one data model includes: querying condition field and precomputation result field;Universal model generation unit can be used for utilizing The non-heavy field establishes universal model, and by the querying condition field data and precomputation result in the multiple data model Field data is stored in the universal model according to the non-heavy field;And query unit, it can be used in response to the difference The query statement for inquiring scene chooses the inquiry language from the precomputation result field data that the universal model stores The corresponding query result data of sentence return.
Optionally, universal model generation unit can be further used for: for any record of any data model: keeping it In the querying condition field of the data model and the value of precomputation result field, using preset non-inquiry mark value as it in institute The value that universal model increases querying condition field newly is stated, the modified record is stored according to the non-heavy field described general Model;Wherein, the newly-increased querying condition field are as follows: in the non-heavy field in addition to the querying condition field of the data model Querying condition field.
Optionally, described device can further comprise: index creation unit, for will be in the multiple data model After querying condition field data and precomputation result field data are stored in the universal model according to the non-heavy field, from Non- heavy index field is determined in index field in the multiple data model, is the non-heavy index word in the universal model Section creation index.
Optionally, query unit can be further used for: in the precomputation result field number of universal model storage In, the corresponding query result data of the query statement are chosen using the index created in the universal model and are returned.
Optionally, for the query statement in either query scene in the different inquiry scenes, querying condition clause It include: the value of the querying condition field of the data model corresponding to the inquiry scene and the newly-increased inquiry item of the data model The non-inquiry mark value of part field;Wherein, the newly-increased querying condition field of the data model are as follows: the number is removed in the non-heavy field According to the querying condition field except the querying condition field of model.
Optionally, the multiple data model and the universal model are tables of data, and the query statement is structuring Query language SQL statement, the querying condition clause are WHERE clause.
To achieve the above object, according to another aspect of the invention, a kind of electronic equipment is provided.
A kind of electronic equipment of the invention includes: one or more processors;Storage device, for storing one or more Program, when one or more of programs are executed by one or more of processors, so that one or more of processors Realize the data query method provided by the present invention based on universal model.
To achieve the above object, in accordance with a further aspect of the present invention, a kind of computer readable storage medium is provided.
A kind of computer readable storage medium of the invention, is stored thereon with computer program, described program is by processor The data query method provided by the present invention based on universal model is realized when execution.
According to the technique and scheme of the present invention, one embodiment in foregoing invention has the following advantages that or the utility model has the advantages that leads to It crosses from the multiple data models for corresponding to different inquiry scenes and extracts non-heavy field and establish universal model, and will be in data model According to non-heavy field, all universal model is arrived in storage to the data of storage, so that universal model can be applied to the institute of legacy data model There is inquiry scene, to reduce data model quantity, database maintenance cost and the front and back end degree of coupling is reduced, before improving Hold the efficiency of application and development and modification;In addition, the present invention determines non-heavy index field from the index field of legacy data model, It is that non-heavy index field creation index obtains general index in universal model, to reduce index quantity, is not influencing to inquire The write performance of database is promoted under the premise of speed.
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 key step schematic diagram of the data query method according to an embodiment of the present invention based on universal model;
Fig. 2 is the major part schematic diagram of the data query device according to an embodiment of the present invention based on universal model;
Fig. 3 is to can be applied to exemplary system architecture figure therein according to embodiments of the present invention;
Fig. 4 is the structure for the electronic equipment for realizing the data query method based on universal model of the embodiment of the present invention Schematic diagram.
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.
In the technical solution of the embodiment of the present invention, by being mentioned from the multiple data models for corresponding to different inquiry scenes Negated heavy field establishes universal model, and according to non-heavy field, all Universal Die is arrived in storage by the data stored in data model Type, to reduce data model quantity, reduces so that universal model can be applied to all inquiry scenes of legacy data model Database maintenance cost and the front and back end degree of coupling improve the efficiency of front end applications exploitation and modification;In addition, the present invention is from original Have and determine non-heavy index field in the index field of data model, is that non-heavy index field creation index obtains in universal model General index promotes the write performance of database to reduce index quantity under the premise of not influencing inquiry velocity.
It should be pointed out that in the absence of conflict, the technical characteristic in the embodiment of the present invention and embodiment can To be combined with each other.
Fig. 1 is the key step schematic diagram of the data query method according to an embodiment of the present invention based on universal model.
As shown in Figure 1, following steps can be performed in the data query method based on universal model of the embodiment of the present invention:
Step S101: non-heavy field is determined from the field of multiple data models for corresponding to different inquiry scenes.
In this step, inquiry scene can choose most fine-grained scene according to application environment, such as correspond to a certain look into Ask the scene of sentence.Such as: it is below to be looked into for two kinds of inquiry scenes of service database source data table and its corresponding SQL Ask sentence:
Scene one: the sales volume of each level-one classification article daily, SQL statement are inquired are as follows:
select date,lvl1_id,sum(num)from table group by date,lvl1_id
Scene two: the sales volume of each second level classification article daily, SQL statement are inquired are as follows:
select date,lvl2_id,sum(num)from table group by date,lvl2_id
Wherein, table is source data table, and date, lvl1_id, lvl2_id, num are respectively date in table, level-one Classification mark, second level classification mark, sales volume field, sum are aggregate functions, and select, group are respectively to choose, be grouped sentence.
In practical application, in order to accelerate inquiry velocity, data model can be established for each inquiry scene, in user query It is preceding that the possible query result of user is determined and stored in the data model in advance.In embodiments of the present invention, data model can To be tables of data.It is the data model to correspond respectively to two kinds of upper example inquiry scenes below:
Data model one (corresponds to inquiry scene one)
date lvl1_id amount
a1 b1 c1
a2 b2 c2
a3 b3 c3
Data model two (corresponds to inquiry scene two)
date lvl2_id amount
a4 d1 c4
a5 d2 c5
a6 d3 c6
Wherein, three records are only illustratively shown in each data model, amount is total sales volume field, for storing The precomputation result of sum function.In data model one, date and lvl1_id are querying condition field, and amount is precomputation Result field;In data model two, date and lvl2_id are querying condition field, and amount is precomputation result field.
In this step, non-heavy field can be determined in the field of multiple data models.Wherein, non-heavy field refers to Remaining field dimension after duplicate removal in all field dimensions of data model.It, can be by field in data model in practical application The different field of name is as non-heavy field.Such as: in upper example, the date field of data model one and data model two and Amount fields name is identical, then the non-heavy field obtained after duplicate removal in data model one, two all fields are as follows: date, lvl1_id,lvl2_id,amount.It obviously, also include querying condition field and precomputation result field in non-heavy field.Example Such as: in above-mentioned non-heavy field, date, lvl1_id, lvl2_id are querying condition field, and amount is precomputation result field.
Step S102: establishing universal model using non-heavy field, and by the querying condition Field Count in multiple data models Universal model is stored according to non-heavy field according to precomputation result field data.
Specifically, the non-heavy field that in this step can be determined step S101 is as the field of universal model, by data The total data of model is stored in universal model.In practical application, universal model can be tables of data.When storing data, for The each of each data model records: keeping it in the querying condition field and precomputation result field of the data model Preset non-inquiry mark value, is increased as it newly the value of querying condition field by value in universal model, and by the modified note Address book stored is in universal model.That is, universal model is often looked into containing what the data model was not present for each data model Condition field (i.e. newly-increased querying condition field) is ask, when by any bar record storage of the data model to universal model, Original field keeps (remaining unchanged), and newly-increased querying condition field is set as non-inquiry mark value such as -99.Such as: it can basis Two data models in upper example determine following universal model:
In step s 102, index can be created in universal model according to the index field of data model also to accelerate to inquire Speed.Specifically, non-heavy index field is determined first from whole index fields of multiple data models, later, in Universal Die Type is that non-heavy index field creation index generates general index for the data query in universal model, thus in universal model Realize whole index functions of legacy data model.Wherein, non-heavy index field refers to all ropes in multiple data models Draw in field remaining index field after duplicate removal.Such as: if the index field of the data model one in upper example is lvl1_id, number According to model two index field be lvl2_id, then be not present duplicate index field, non-heavy index field be lvl1_id and Lvl2_id can be that lvl1_id field and lvl2_id field creation index obtain general index in universal model, to realize original There is the repertoire of index.
By step S101 and S102, the present invention can effectively reduce data model number under the premise of not influencing search efficiency Amount improves front end applications to reduce database maintenance cost and the front and back end degree of coupling with the index quantity in data model Exploitation modification efficiency, and optimize the write performance of database.
Step S103: in response to the query statement of different inquiry scenes, the precomputation result field stored from universal model The corresponding query result data of query statement are chosen in data to return.
In this step, data query is carried out using the universal model that step S101 and S102 are established.Due to Universal Die Contain non-inquiry mark value in type, therefore non-inquiry mark value can be increased in query statement.
Specifically, for the query statement in either query scene, the WHERE clause of querying condition clause such as SQL can It include: the value of the querying condition field of the data model corresponding to the inquiry scene and the newly-increased querying condition of the data model The non-inquiry mark value of field.Such as: using upper example universal model (table1) carry out data query when, can use with Lower SQL query statement:
Inquire certain day (when the sales volume of some level-one classification article (being identified as y) of date x), SQL statement are as follows:
Select date, lvl1_id, lvl2_id, amount from table1where date=x and lvl1_ Id=y and lvl2_id=-99
Inquire certain day (when the sales volume of some second level classification article (being identified as z) of date x), SQL statement are as follows:
Select date, lvl1_id, lvl2_id, amount from table1where date=x and lvl1_ Id=-99and lvl2_id=z
In this step, after receiving above-mentioned query statement, the precomputation result field number that can be stored in universal model According to determining that query result data return in (such as c1-c6), to replace original multiple data models to carry out with a universal model Data query can be applied to the corresponding all inquiry scenes of original multiple data models.
Though it is understood that above carrying out example, the number based on universal model of the embodiment of the present invention with SQL It can be applied to any applicable database such as MYSQL, ORACLE, DB2, Sybase according to querying method.
In the technical solution of the embodiment of the present invention, by being mentioned from the multiple data models for corresponding to different inquiry scenes Negated heavy field establishes universal model, and according to non-heavy field, all Universal Die is arrived in storage by the data stored in data model Type, to reduce data model quantity, reduces so that universal model can be applied to all inquiry scenes of legacy data model Database maintenance cost and the front and back end degree of coupling improve the efficiency of front end applications exploitation and modification;In addition, the present invention is from original Have and determine non-heavy index field in the index field of data model, is that non-heavy index field creation index obtains in universal model General index promotes the write performance of database to reduce index quantity under the premise of not influencing inquiry velocity.
Fig. 2 is the major part schematic diagram of the data query device based on universal model of the embodiment of the present invention.
As shown in Fig. 2, the data query device 200 based on universal model of the embodiment of the present invention can include: duplicate removal unit 201, universal model generation unit 202 and query unit 203.Wherein:
Duplicate removal unit 201 can be used for determining non-heavy word from the field of multiple data models for corresponding to different inquiry scenes Section;Wherein, the field of each data model in the multiple data model includes: querying condition field and precomputation result word Section;
Universal model generation unit 202 can be used for establishing universal model using the non-heavy field, and by the multiple number According in model querying condition field data and precomputation result field data be stored according to the non-heavy field it is described general Model;
Query unit 203 can be used for storing in response to the query statement of the different inquiry scenes from the universal model The precomputation result field data in choose the corresponding query result data of the query statement and return.
In embodiments of the present invention, universal model generation unit 202 can be further used for: for appointing for any data model One record: it keeps it in the querying condition field of the data model and the value of precomputation result field, preset non-inquiry is marked Note value increases the value of querying condition field newly as it in the universal model, by the modified record according to the non-heavy field It is stored in the universal model;Wherein, the newly-increased querying condition field are as follows: looking into except the data model in the non-heavy field Ask the querying condition field except condition field.
As a preferred embodiment, described device 200 can further comprise: index creation unit, for will be described more Querying condition field data and precomputation result field data in a data model are stored in described according to the non-heavy field After universal model, non-heavy index field is determined from the index field in the multiple data model, in the universal model For the non-heavy index field creation index.
Preferably, in embodiments of the present invention, query unit 203 can be further used for: in universal model storage In the precomputation result field data, looked into using the index selection query statement created in the universal model is corresponding Result data is ask to return.
In practical application, for the query statement in either query scene in the different inquiry scenes, querying condition Clause includes: to look into corresponding to the value of querying condition field of the data model of the inquiry scene and the newly-increased of the data model Ask the non-inquiry mark value of condition field;Wherein, the newly-increased querying condition field of the data model are as follows: removed in the non-heavy field Querying condition field except the querying condition field of the data model.
In an optional implementation, the multiple data model and the universal model are tables of data, the inquiry Sentence is structured query language SQL statement, and the querying condition clause is WHERE clause.
In the technical solution of the embodiment of the present invention, by being mentioned from the multiple data models for corresponding to different inquiry scenes Negated heavy field establishes universal model, and according to non-heavy field, all Universal Die is arrived in storage by the data stored in data model Type, to reduce data model quantity, reduces so that universal model can be applied to all inquiry scenes of legacy data model Database maintenance cost and the front and back end degree of coupling improve the efficiency of front end applications exploitation and modification;In addition, the present invention is from original Have and determine non-heavy index field in the index field of data model, is that non-heavy index field creation index obtains in universal model General index promotes the write performance of database to reduce index quantity under the premise of not influencing inquiry velocity.
Fig. 3 is shown can be using data query method of the embodiment of the present invention based on universal model or based on Universal Die The exemplary system architecture 300 of the data query device of type.
As shown in figure 3, system architecture 300 may include terminal device 301,302,303, network 304 and server 305 (this framework is only example, and the component for including in specific framework can be according to the adjustment of application concrete condition).Network 304 to The medium of communication link is provided between terminal device 301,302,303 and server 305.Network 304 may include various connections Type, such as wired, wireless communication link or fiber optic cables etc..
User can be used terminal device 301,302,303 and be interacted by network 304 with server 305, 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 301,302,303 (merely illustrative) such as the application of page browsing device, searching class application, instant messaging tools, mailbox client, social platform softwares.
Terminal device 301,302,303 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 305 can be to provide the server of various services, such as utilize terminal device 301,302,303 to user The shopping class website browsed provides the back-stage management server (merely illustrative) supported.Back-stage management server can be to reception To the data such as information query request analyze etc. processing, and by processing result (such as target push information, product letter Breath -- merely illustrative) feed back to terminal device.
It should be noted that the data query method based on universal model provided by the embodiment of the present invention is generally by servicing Device 305 executes, and correspondingly, the data query device based on universal model is generally positioned in server 305.
It should be understood that the number of terminal device, network and server in Fig. 3 is only schematical.According to realization need It wants, can have any number of terminal device, network and server.
The present invention also provides a kind of electronic equipment.The electronic equipment of the embodiment of the present invention includes: one or more processing Device;Storage device, for storing one or more programs, when one or more of programs are by one or more of processors It executes, so that one or more of processors realize the data query method provided by the present invention based on universal model.
Below with reference to Fig. 4, it illustrates the computer systems 400 for the electronic equipment for being suitable for being used to realize the embodiment of the present invention Structural schematic diagram.Electronic equipment shown in Fig. 4 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 4, computer system 400 includes central processing unit (CPU) 401, it can be read-only according to being stored in Program in memory (ROM) 402 or be loaded into the program in random access storage device (RAM) 403 from storage section 408 and Execute various movements appropriate and processing.In RAM403, be also stored with computer system 400 operate required various programs and Data.CPU601, ROM 402 and RAM 403 is connected with each other by bus 404.Input/output (I/O) interface 405 also connects To bus 404.
I/O interface 405 is connected to lower component: the importation 406 including keyboard, mouse etc.;It is penetrated including such as cathode The output par, c 407 of spool (CRT), liquid crystal display (LCD) etc. and loudspeaker etc.;Storage section 408 including hard disk etc.; And the communications portion 409 of the network interface card including LAN card, modem etc..Communications portion 409 via such as because The network of spy's net executes communication process.Driver 410 is also connected to I/O interface 405 as needed.Detachable media 411, such as Disk, CD, magneto-optic disk, semiconductor memory etc. be mounted on as needed on driver 410, so as to from reading thereon Computer program is mounted into storage section 408 as needed.
Particularly, disclosed embodiment, the process of key step figure description above may be implemented as according to the present invention Computer software programs.For example, the embodiment of the present invention includes a kind of computer program products comprising be carried on computer-readable Computer program on medium, the computer program include the program code for executing method shown in key step figure.? In above-described embodiment, which can be downloaded and installed from network by communications portion 409, and/or from removable Medium 411 is unloaded to be mounted.When the computer program is executed by central processing unit 401, executes and limited in system of the invention Above-mentioned function.
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.In this hair In bright, 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 not limited to electric Magnetic signal, optical signal or above-mentioned any appropriate combination.Computer-readable signal media can also be computer-readable storage medium Any computer-readable medium other than matter, the computer-readable medium can be sent, propagated or transmitted for being held by instruction Row system, device or device use or program in connection.The program code for including on computer-readable medium It can transmit with any suitable medium, including but not limited to: wireless, electric wire, optical cable, RF etc. or above-mentioned any conjunction Suitable 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, this is depending on related function.? It should be noted that the combination of block diagram or each box in flow chart and the box in block diagram or flow chart, can use execution The dedicated hardware based systems of defined functions or operations realizes, or can use specialized hardware and computer instruction Combination is to realize.
Being described in unit 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 unit also can be set in the processor, for example, can be described as: a kind of processor packet Include duplicate removal unit, universal model generation unit and query unit.Wherein, the title of these units not structure under certain conditions The restriction of the pairs of unit itself, for example, duplicate removal unit is also described as " sending non-heavy word to universal model generation unit The unit of section ".
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 meter Calculation machine readable medium carries one or more program, when said one or multiple programs are executed by the equipment, so that The step of equipment executes includes: to determine non-heavy field from the field of multiple data models for corresponding to different inquiry scenes; Wherein, the field of each data model in the multiple data model includes: querying condition field and precomputation result field; Universal model is established using the non-heavy field, and by the querying condition field data and precomputation in the multiple data model Result field data are stored in the universal model according to the non-heavy field;And in response to the different inquiry scenes Query statement chooses that the query statement is corresponding to be looked into from the precomputation result field data that the universal model stores Result data is ask to return
In the technical solution of the embodiment of the present invention, by being mentioned from the multiple data models for corresponding to different inquiry scenes Negated heavy field establishes universal model, and according to non-heavy field, all Universal Die is arrived in storage by the data stored in data model Type, to reduce data model quantity, reduces so that universal model can be applied to all inquiry scenes of legacy data model Database maintenance cost and the front and back end degree of coupling improve the efficiency of front end applications exploitation and modification;In addition, the present invention is from original Have and determine non-heavy index field in the index field of data model, is that non-heavy index field creation index obtains in universal model General index promotes the write performance of database to reduce index quantity under the premise of not influencing inquiry velocity.
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 (14)

1. a kind of data query method based on universal model characterized by comprising
Non- heavy field is determined from the field of multiple data models for corresponding to different inquiry scenes;Wherein, the multiple data The field of each data model in model includes: querying condition field and precomputation result field;
Universal model is established using the non-heavy field, and by the querying condition field data in the multiple data model and in advance Calculated result field data is stored in the universal model according to the non-heavy field;And
In response to the query statement of the different inquiry scenes, the precomputation result field number stored from the universal model It is returned according to the middle corresponding query result data of the query statement of choosing.
2. the method according to claim 1, wherein the querying condition word by the multiple data model Segment data and precomputation result field data are stored in the universal model according to the non-heavy field and include:
For any record of any data model: keeping it in the querying condition field and precomputation result word of the data model The value of section increases the value of querying condition field newly using preset non-inquiry mark value as it, after modification in the universal model The record be stored in the universal model according to the non-heavy field;
Wherein, the newly-increased querying condition field are as follows: in the non-heavy field in addition to the querying condition field of the data model Querying condition field.
3. the method according to claim 1, wherein the method further includes:
By in the multiple data model querying condition field data and precomputation result field data according to the non-heavy word Section is stored in after the universal model, and non-heavy index field is determined from the index field in the multiple data model, The universal model is the non-heavy index field creation index.
4. according to the method described in claim 3, it is characterized in that, the precomputation knot stored from the universal model The corresponding query result data return of the query statement is chosen in fruit field data includes:
In the precomputation result field data of universal model storage, the index created in the universal model is utilized The corresponding query result data of the query statement are chosen to return.
5. according to the method described in claim 2, it is characterized in that, in either query scene in the different inquiry scenes Query statement, querying condition clause include: the querying condition field corresponding to the data model of the inquiry scene value, with And the non-inquiry mark value of the newly-increased querying condition field of the data model;Wherein,
The newly-increased querying condition field of the data model are as follows: in the non-heavy field except the data model querying condition field it Outer querying condition field.
6. according to the method described in claim 5, it is characterized in that, the multiple data model and the universal model are number According to table, the query statement is structured query language SQL statement, and the querying condition clause is WHERE clause.
7. a kind of data query device based on universal model characterized by comprising
Duplicate removal unit, for determining non-heavy field from the field of multiple data models for corresponding to different inquiry scenes;Wherein, The field of each data model in the multiple data model includes: querying condition field and precomputation result field;
Universal model generation unit, for establishing universal model using the non-heavy field, and will be in the multiple data model Querying condition field data and precomputation result field data according to the non-heavy field be stored in the universal model;And
Query unit stores described pre- for the query statement in response to the different inquiry scenes from the universal model The corresponding query result data of the query statement are chosen in calculated result field data to return.
8. device according to claim 7, which is characterized in that universal model generation unit is further used for:
For any record of any data model: keeping it in the querying condition field and precomputation result word of the data model The value of section increases the value of querying condition field newly using preset non-inquiry mark value as it, after modification in the universal model The record be stored in the universal model according to the non-heavy field;Wherein, the newly-increased querying condition field are as follows: described non- Querying condition field in weight field in addition to the querying condition field of the data model.
9. the method according to the description of claim 7 is characterized in that described device further comprises:
Index creation unit, for by the querying condition field data and precomputation result field in the multiple data model After data are stored in the universal model according to the non-heavy field, from the index field in the multiple data model really Fixed non-heavy index field is the non-heavy index field creation index in the universal model.
10. device according to claim 9, which is characterized in that query unit is further used for:
In the precomputation result field data of universal model storage, the index created in the universal model is utilized The corresponding query result data of the query statement are chosen to return.
11. device according to claim 8, which is characterized in that for either query scene in the different inquiry scenes In query statement, querying condition clause include: the querying condition field corresponding to the data model of the inquiry scene value, And the non-inquiry mark value of the newly-increased querying condition field of the data model;Wherein, the newly-increased querying condition of the data model Field are as follows: the querying condition field in the non-heavy field in addition to the querying condition field of the data model.
12. device according to claim 11, which is characterized in that the multiple data model and the universal model are Tables of data, the query statement are structured query language SQL statement, and the querying condition clause is WHERE clause.
13. a kind of electronic equipment 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 Now such as method as claimed in any one of claims 1 to 6.
14. a kind of computer readable storage medium, is stored thereon with computer program, which is characterized in that described program is processed Such as method as claimed in any one of claims 1 to 6 is realized when device executes.
CN201810058806.4A 2018-01-22 2018-01-22 Data query method and apparatus based on universal model Pending CN110110211A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810058806.4A CN110110211A (en) 2018-01-22 2018-01-22 Data query method and apparatus based on universal model

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810058806.4A CN110110211A (en) 2018-01-22 2018-01-22 Data query method and apparatus based on universal model

Publications (1)

Publication Number Publication Date
CN110110211A true CN110110211A (en) 2019-08-09

Family

ID=67483443

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810058806.4A Pending CN110110211A (en) 2018-01-22 2018-01-22 Data query method and apparatus based on universal model

Country Status (1)

Country Link
CN (1) CN110110211A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117874009A (en) * 2024-03-13 2024-04-12 云筑信息科技(成都)有限公司 System for creating and managing several warehouse models

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080162415A1 (en) * 2006-12-28 2008-07-03 Sap Ag Software and method for utilizing a common database layout
CN103425672A (en) * 2012-05-17 2013-12-04 阿里巴巴集团控股有限公司 Method and device for creating indexes of database
CN106156168A (en) * 2015-04-16 2016-11-23 华为技术有限公司 The method of data is being inquired about and across subregion inquiry unit in partitioned data base
CN106570022A (en) * 2015-10-10 2017-04-19 阿里巴巴集团控股有限公司 Cross-data-source query method, apparatus and system
US20170185635A1 (en) * 2015-12-29 2017-06-29 Cognizant Technology Solutions India Pvt. Ltd. Method and system for identifying and analyzing hidden data relationships in databases
CN106919637A (en) * 2016-07-04 2017-07-04 阿里巴巴集团控股有限公司 Unique index is created and uniqueness querying method and device
JP6159908B1 (en) * 2016-03-31 2017-07-05 スマートインサイト株式会社 Method, program, and system for automatic discovery of relationships between fields in a heterogeneous data source mixed environment

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080162415A1 (en) * 2006-12-28 2008-07-03 Sap Ag Software and method for utilizing a common database layout
CN103425672A (en) * 2012-05-17 2013-12-04 阿里巴巴集团控股有限公司 Method and device for creating indexes of database
CN106156168A (en) * 2015-04-16 2016-11-23 华为技术有限公司 The method of data is being inquired about and across subregion inquiry unit in partitioned data base
CN106570022A (en) * 2015-10-10 2017-04-19 阿里巴巴集团控股有限公司 Cross-data-source query method, apparatus and system
US20170185635A1 (en) * 2015-12-29 2017-06-29 Cognizant Technology Solutions India Pvt. Ltd. Method and system for identifying and analyzing hidden data relationships in databases
JP6159908B1 (en) * 2016-03-31 2017-07-05 スマートインサイト株式会社 Method, program, and system for automatic discovery of relationships between fields in a heterogeneous data source mixed environment
CN106919637A (en) * 2016-07-04 2017-07-04 阿里巴巴集团控股有限公司 Unique index is created and uniqueness querying method and device

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117874009A (en) * 2024-03-13 2024-04-12 云筑信息科技(成都)有限公司 System for creating and managing several warehouse models

Similar Documents

Publication Publication Date Title
CN110472207A (en) List generation method and device
CN110209677A (en) The method and apparatus of more new data
CN109388654A (en) A kind of method and apparatus for inquiring tables of data
CN109413127A (en) A kind of method of data synchronization and device
CN107609890A (en) A kind of method and apparatus of order tracking
CN109034988A (en) A kind of accounting entry generation method and device
CN106326243B (en) Data processing method and device
CN110019125A (en) The method and apparatus of data base administration
CN110019258A (en) The method and apparatus for handling order data
CN107506218A (en) The management method and management system of a kind of configuration file
CN110019367A (en) A kind of method and apparatus of statistical data feature
CN111666293A (en) Database access method and device
CN110019263A (en) Information storage means and device
CN109840817A (en) A kind of method and apparatus for inquiring order information
CN110134427A (en) A kind of method and apparatus generating code file
CN110309142A (en) The method and apparatus of regulation management
CN109597810A (en) A kind of task cutting method, device, medium and electronic equipment
CN110109983A (en) A kind of method and apparatus operating Redis database
CN109960212A (en) Task sending method and device
CN110263791A (en) A kind of method and apparatus in identification function area
CN110362583A (en) A kind of data processing method and device for multi-data source
CN108959294A (en) A kind of method and apparatus accessing search engine
CN108460020A (en) Method and device for obtaining information
CN110110211A (en) Data query method and apparatus based on universal model
CN110019802A (en) A kind of method and apparatus of text cluster

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