CN107015987B - Method and equipment for updating and searching database - Google Patents

Method and equipment for updating and searching database Download PDF

Info

Publication number
CN107015987B
CN107015987B CN201610056622.5A CN201610056622A CN107015987B CN 107015987 B CN107015987 B CN 107015987B CN 201610056622 A CN201610056622 A CN 201610056622A CN 107015987 B CN107015987 B CN 107015987B
Authority
CN
China
Prior art keywords
dimension
dimension information
index
search
information
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201610056622.5A
Other languages
Chinese (zh)
Other versions
CN107015987A (en
Inventor
康军卫
陈岳阳
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Cainiao Smart Logistics Holding Ltd
Original Assignee
Cainiao Smart Logistics Holding 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 Cainiao Smart Logistics Holding Ltd filed Critical Cainiao Smart Logistics Holding Ltd
Priority to CN201610056622.5A priority Critical patent/CN107015987B/en
Publication of CN107015987A publication Critical patent/CN107015987A/en
Application granted granted Critical
Publication of CN107015987B publication Critical patent/CN107015987B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

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/22Indexing; Data structures therefor; Storage structures
    • G06F16/2282Tablespace storage structures; Management thereof
    • 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/23Updating
    • G06F16/2379Updates performed during online database operations; commit processing

Landscapes

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

Abstract

The embodiment of the disclosure discloses a method and equipment for updating a database, which are used for solving the problems that the existing real-time database is basically personalized development facing to specific business requirements and does not have expansibility. The method comprises the steps that the changed index value is obtained from a data system corresponding to the index; determining a target dimension information group corresponding to each changed index value; determining all dimensions corresponding to the indexes in the database according to the corresponding relation between the indexes and the dimensions; selecting a dimension information group matched with the target dimension information group from the dimension information groups corresponding to all the determined dimensions; and updating the index value corresponding to the dimension information group in the database by using the index value corresponding to the target dimension information group. When the database of the embodiment of the disclosure is oriented to specific service requirements, only the indexes and the specific meanings of the dimensions need to be modified, and redevelopment is not needed, so that the expansibility is improved. The embodiment of the disclosure also discloses a method and equipment for searching the database.

Description

Method and equipment for updating and searching database
Technical Field
The present disclosure relates to the field of data processing technologies, and in particular, to a method and an apparatus for updating and searching a database.
Background
Real Time Data Base (RTDB) is a branch of database system development, which is generated by combining database technology with Real-Time processing technology.
In the process industry, a real-time database system is largely used for monitoring a control system, the system is advanced in control and optimization control, and real-time data service and various data management functions are provided for production management and scheduling, data analysis, decision support and remote online browsing of enterprises. The real-time database becomes an enterprise informatization basic data platform, can directly acquire and acquire various data in the enterprise operation process in real time, and convert the data into effective public information for various services, meets the requirements of enterprise production management, enterprise process monitoring and enterprise operation management on the integrity, consistency and safety sharing of the real-time information, and can establish a bridge for information communication between an enterprise automation system and a management information system. And each professional management department of an enterprise is helped to utilize the key real-time information, and the production and sales operation efficiency is improved.
In the E-commerce platform, the seller can master the quantity, the state and the like of the inventory commodities in real time through the real-time database, so that the commodities can be dispatched more quickly and efficiently.
The current real-time database is basically personalized development facing specific service requirements and has no expansibility.
Disclosure of Invention
The present disclosure provides a method and device for updating and searching database data, which are used to solve the problem that the current real-time database in the prior art is basically personalized development for specific business requirements and does not have expansibility.
The embodiment of the disclosure provides a method for updating a database, which includes:
acquiring the changed index value from the data system corresponding to the index; determining a target dimension information group corresponding to each changed index value;
determining all dimensions corresponding to the indexes in the database according to the corresponding relation between the indexes and the dimensions;
selecting a dimension information group matched with the target dimension information group from the dimension information groups corresponding to all the determined dimensions;
and updating the index value corresponding to the selected dimension information group in the database by using the index value corresponding to the target dimension information group.
Because the database of the embodiment of the disclosure is established through the indexes and the dimensions, when the specific service requirements are oriented, only the specific meanings of the indexes and the dimensions need to be modified, and redevelopment is not needed, so that the expansibility is improved.
Optionally, selecting a dimension information group matched with the target dimension information group from the dimension information groups corresponding to all the determined dimensions, includes:
and selecting the dimension information group which is the same as the target dimension information group from the dimension information groups corresponding to all the determined dimensions.
Optionally, the updating the index value corresponding to the database and the dimension information group by using the index value corresponding to the target dimension information group includes:
determining an index value corresponding to the selected dimension information group in the database according to the corresponding relation between the dimension information group and the index value;
and updating the determined index value by using the index value corresponding to the target dimension information group.
The index value corresponding to the degree information group can be found according to the corresponding relation between the dimension information group and the index value, so that the index value can be updated more accurately.
Optionally, after determining all dimensions corresponding to the index according to the corresponding relationship between the index and the dimensions, the method further includes:
and if the dimension information groups corresponding to all the dimensions do not have the dimension information group matched with the target dimension information group, taking the target dimension information as one dimension information group, adding the dimension information into the dimension information groups corresponding to all the dimensions, and establishing a corresponding relation between the dimension information group and the corresponding index value in the database.
The embodiment of the disclosure can add the corresponding relation between the dimensional information group which is not in the database and the corresponding index value into the database, thereby improving the content of the database.
Optionally, the method further includes:
if a dimension deleting command is received, deleting the dimension in the dimension deleting command and the dimension information corresponding to the dimension from the database;
and if an index deleting command is received, deleting the indexes in the index deleting command, the dimension and the index value corresponding to the indexes and the dimension information corresponding to the dimension from the database.
The embodiment of the disclosure provides a method for searching a database, which includes:
receiving a search instruction containing search information, wherein the search information comprises dimension search information and/or index search information;
determining dimensionality, dimensionality information and indexes needing to be inquired in a database according to the search information;
and determining a search result according to the dimension, the dimension information and the index which need to be inquired.
Because the database of the embodiment of the disclosure is established through the indexes and the dimensions, when the specific service requirements are oriented, only the specific meanings of the indexes and the dimensions need to be modified, and redevelopment is not needed, so that the expansibility is improved.
Furthermore, because the corresponding relation between the indexes and the dimensions is established in the database of the embodiment of the disclosure, the real-time database can be effectively indexed, and the searching efficiency is improved.
Optionally, determining the dimension, the dimension information, and the index to be queried in the database according to the search information includes:
if the search information comprises dimension search information, according to the corresponding relation between the dimension and the index, taking the index corresponding to the dimension in the dimension search information as the index needing to be inquired, and taking the dimension information in the dimension search information as the dimension information needing to be inquired; or
And if the search information comprises index search information, according to the corresponding relation between the dimensionality and the index, taking the dimensionality corresponding to the index in the index search information as the dimensionality needing to be inquired, and taking the dimensionality information corresponding to the dimensionality needing to be inquired as the dimensionality information needing to be inquired.
Optionally, determining the search result according to the dimension, the dimension information, and the index that need to be queried includes:
forming at least one search dimension information group by using the dimension information to be inquired, wherein the dimension information included in each search dimension information group belongs to different dimensions, and each search dimension information group comprises all the dimensions to be searched;
and aiming at a search dimension information group and an index needing to be inquired, selecting a dimension information group matched with the search dimension information group from the dimension information groups of all dimensions corresponding to the determined index, and taking the sum of index values corresponding to each selected dimension information group as a search result corresponding to the search dimension information group and the index.
The corresponding search result can be determined according to the dimension information group and the index, so that different search requirements of users can be met.
Optionally, selecting, from the determined dimension information groups of all dimensions corresponding to the index, a dimension information group in the database that matches the search dimension information group includes:
and selecting a dimension information group containing all dimension information in the search dimension information group in the database from the determined dimension information groups of all dimensions corresponding to the indexes.
Optionally, after the sum of the index values corresponding to each selected dimension information group is used as the search result corresponding to the search dimension information group and the index, the method further includes:
and after determining the search results corresponding to all the search dimension information groups and indexes, displaying the search results in a search result display interface.
An apparatus for updating a database provided by an embodiment of the present disclosure includes:
the processing module is used for acquiring the changed index value from the data system corresponding to the index; determining a target dimension information group corresponding to each changed index value;
the dimension determining module is used for determining all dimensions corresponding to the indexes in the database according to the corresponding relation between the indexes and the dimensions;
the selection module is used for selecting a dimension information group matched with the target dimension information group from the dimension information groups corresponding to all the determined dimensions;
and the updating module is used for updating the index value corresponding to the selected dimension information group in the database by using the index value corresponding to the target dimension information group.
Optionally, the selection module is specifically configured to:
and selecting the dimension information group which is the same as the target dimension information group from the dimension information groups corresponding to all the determined dimensions.
Optionally, the update module is specifically configured to:
determining an index value corresponding to the selected dimension information group in the database according to the corresponding relation between the dimension information group and the index value;
and updating the determined index value by using the index value corresponding to the target dimension information group.
Optionally, the update module is further configured to:
and if the dimension information groups corresponding to all the dimensions do not have the dimension information group matched with the target dimension information group, taking the target dimension information as one dimension information group, adding the dimension information into the dimension information groups corresponding to all the dimensions, and establishing a corresponding relation between the dimension information group and the corresponding index value in the database.
Optionally, the processing module is further configured to:
if a dimension deleting command is received, deleting the dimension in the dimension deleting command and the dimension information corresponding to the dimension from the database;
and if an index deleting command is received, deleting the indexes in the index deleting command, the dimension and the index value corresponding to the indexes and the dimension information corresponding to the dimension from the database.
The embodiment of the disclosure provides a device for searching a database, and the method comprises the following steps:
the system comprises a receiving module, a searching module and a searching module, wherein the receiving module is used for receiving a searching instruction containing searching information, and the searching information comprises dimension searching information and/or index searching information;
the query information determining module is used for determining the dimension, the dimension information and the index which need to be queried in the database according to the search information;
and the search result determining module is used for determining the search result according to the dimension, the dimension information and the index which need to be inquired.
Optionally, the query information determining module is specifically configured to:
if the search information comprises dimension search information, according to the corresponding relation between the dimension and the index, taking the index corresponding to the dimension in the dimension search information as the index needing to be inquired, and taking the dimension information in the dimension search information as the dimension information needing to be inquired; or
And if the search information comprises index search information, according to the corresponding relation between the dimensionality and the index, taking the dimensionality corresponding to the index in the index search information as the dimensionality needing to be inquired, and taking the dimensionality information corresponding to the dimensionality needing to be inquired as the dimensionality information needing to be inquired.
Optionally, the search result determining module is specifically configured to:
forming at least one search dimension information group by using the dimension information to be inquired, wherein the dimension information included in each search dimension information group belongs to different dimensions, and each search dimension information group comprises all the dimensions to be searched;
and aiming at a search dimension information group and an index needing to be inquired, selecting a dimension information group matched with the search dimension information group from the dimension information groups of all dimensions corresponding to the determined index, and taking the sum of index values corresponding to each selected dimension information group as a search result corresponding to the search dimension information group and the index.
Optionally, the search result determining module is specifically configured to:
and selecting a dimension information group containing all dimension information in the search dimension information group in the database from the determined dimension information groups of all dimensions corresponding to the indexes.
Optionally, the search result determining module is further configured to:
and after determining the search results corresponding to all the search dimension information groups and indexes, displaying the search results in a search result display interface.
Drawings
FIG. 1 is a schematic flow chart illustrating a method for updating a database according to an embodiment of the present disclosure;
FIG. 2A is a schematic flow chart illustrating a method for updating data according to an embodiment of the present disclosure;
FIG. 2B is a schematic flow chart of a complete method for deleting data according to an embodiment of the present disclosure;
FIG. 3 is a schematic flow chart illustrating a method for searching a database according to an embodiment of the present disclosure;
FIG. 4 is a schematic diagram of an apparatus for updating a database according to an embodiment of the present disclosure;
fig. 5 is a schematic structural diagram of an apparatus for searching a database according to an embodiment of the present disclosure.
Detailed Description
The method comprises the steps that the changed index value is obtained from a data system corresponding to the index; determining a target dimension information group corresponding to each changed index value; determining all dimensions corresponding to the indexes in the database according to the corresponding relation between the indexes and the dimensions; selecting a dimension information group matched with the target dimension information group from the dimension information groups corresponding to all the determined dimensions; and updating the index value corresponding to the selected dimension information group in the database by using the index value corresponding to the target dimension information group. Because the database of the embodiment of the disclosure is established through the indexes and the dimensions, when the specific service requirements are oriented, only the specific meanings of the indexes and the dimensions need to be modified, and redevelopment is not needed, so that the expansibility is improved.
The database of the embodiment of the disclosure can be applied to a scenario of recording the quantity of the commodity, for example, the index may be commodity inventory, sales quantity, and the like, and the dimension is information related to the commodity, such as commodity type, commodity manufacturer, inventory location, and the like.
It should be noted that the above application scenarios are only examples, and other scenarios that need to record the number of certain objects are all applicable to the embodiments of the present disclosure.
Before specifically describing aspects of the present disclosure, a database of the following embodiments of the present disclosure is described.
The database of an embodiment of the present disclosure includes metrics and dimensions.
Indexes are as follows: the value with specific meaning in a service or system is the index value.
For example, the database records the stock available for sale of the goods, the total stock in the warehouse of the goods, the sales quantity of the goods, and the like, and then the stock available for sale, the total stock in the warehouse and the sales quantity are indexes, the specific value of the stock available for sale is an index value of the stock available for sale, the specific value of the total stock in the warehouse is an index value of the total stock in the warehouse, and the specific value of the sales quantity is an index value of the sales quantity.
The data structure of the index can be seen in table 1:
Figure GDA0002449160100000081
TABLE 1
The data storage structure of the index can be seen in table 2:
attribute name Name of Chinese Type (B) Remarks for note
id Physical identification long
zb_meta_id Index id long
zb_meta_name Index name string
value Index value string
biz_time Service time date
biz_primary_key Service key string
version Data version long
TABLE 2
The index is just a definition of a specific numerical value, such as the stock 800, but 800 is a specific commodity and needs to be described by dimension.
The dimension is used to limit the range of the index, and it can also be said that the user can use the dimension as a condition for querying a specific index of a condition.
Such as: for marketable inventory, dimensions such as item id, item name, warehouse code, industry and the like can be added to the marketable inventory. Thus, when a marketable inventory is queried, it may be queried according to these dimensions.
The data structure of the dimensions can be seen in table 3:
Figure GDA0002449160100000091
TABLE 3
The data storage structure of the dimension can be seen in table 4:
Figure GDA0002449160100000092
TABLE 4
Index and dimension relationship:
since the dimension is used to define the range of the index, a corresponding relationship between the index and the dimension needs to be established.
In the database of the embodiment of the disclosure, one dimension may correspond to a plurality of indexes, and one index may also correspond to a plurality of dimensions.
For example, if the brand a, the type of product is color tv, and the model X is 1000 in the beijing warehouse, the inventory is an index, and the brand, the type of product, the model, and the warehouse are dimensions, and the inventory corresponds to the brand, the type of product, the model, and the warehouse.
Also, for example, inventory quantity, quantity in transit, and quantity sold for brand A, where inventory quantity, quantity in transit, and quantity sold are all references, and brand is a dimension, then brand corresponds to inventory quantity, quantity in transit, and quantity sold.
The data definition structure of the index dimension correspondence can be seen in table 5:
Figure GDA0002449160100000101
TABLE 5
It should be noted that the structures in the above table are only examples, and the embodiments of the present disclosure are applicable to any structures that can implement indexes and dimensions.
Embodiments of the present disclosure are described in further detail below with reference to the drawings.
As shown in fig. 1, a method for updating a database according to an embodiment of the present disclosure includes:
step 101, obtaining a changed index value from a data system corresponding to the index; determining a target dimension information group corresponding to each changed index value;
step 102, determining all dimensions corresponding to indexes in a database according to the corresponding relation between the indexes and the dimensions;
103, selecting a dimension information group matched with the target dimension information group from the dimension information groups corresponding to all the determined dimensions;
and 104, updating the index value corresponding to the selected dimension information group in the database by using the index value corresponding to the target dimension information group.
In implementation, the database of the embodiment of the disclosure may obtain required data from data systems corresponding to different indexes. For example, the service index is acquired from the service system when the service index is needed.
Specific data systems include, but are not limited to, some or all of the following:
DB (database), service system and off-line data analysis platform
In implementation, all indexes can be detected, and if the index value changes, required data is acquired from a corresponding data system, so that real-time data updating is realized.
Taking DB as an example, data of a DB table related to indexes are accessed from DB in real time, and when the data of the DB table changes, the data are obtained and converted into the indexes and the dimensions.
These changing data can be obtained technically using tools provided by the DB, or using tools of a third party. Alternatively, when monitoring data changes, a plurality of DB tables may be monitored at the same time. Such as inventory, requires monitoring inventory tables and inventory log change tables of the warehouse center.
Take a business system as an example. The changed service data is obtained mainly by subscribing to the service event message of the service system. The changed service data may be obtained by using message middleware. For example, when the inventory change message of the inventory center is subscribed, the inventory is decreased once the commodity is sold, and the message is received immediately to update the relevant indexes.
After the changed index value is acquired, the corresponding target dimension information group can be determined according to the index value.
The dimension information here is a specific value in each dimension, for example, the warehouse is a dimension, the value of the dimension includes beijing and shanghai, and then beijing is a dimension information, and shanghai is also a dimension information.
Also, for example, if the product model is a dimension whose value includes 42 inches of color and 47 inches of color tv, the 42 inches of color tv is one dimension information, and the 47 inches of color tv is also one dimension information.
One dimension information group of the embodiment of the disclosure includes at least one dimension information.
For example, the stock of brand A, color TV type, and 42 inch in Beijing warehouse is changed from 1000 to 900.
After the information is obtained, it can be determined that the dimension corresponding to the index of the inventory has a brand, a commodity type, a model and a warehouse, and the target dimension information group corresponding to the index value of 900 includes a, a color television, 42 inches and beijing.
The corresponding relation between the dimension information group and the index value of each commodity is stored in the database. For example, if 50 coats of ZZ brand jacket are in stock in beijing, the corresponding dimensions of the stock include warehouse, type of goods, brand, and model. These dimensions may correspond directly to a ZZ brand jacket. The corresponding relation between the dimension information group of the jacket and the index value is that Beijing, the jacket and ZZ form one dimension information group, and the corresponding index value is 50 pieces.
Taking some indexes and dimensions in the inventory index scenario as examples:
the index definition can be seen in Table 6
Figure GDA0002449160100000121
TABLE 6
The dimension definitions can be found in Table 7
Figure GDA0002449160100000131
TABLE 7
In practice, a product may correspond to multiple indicators, such as sales numbers, etc., in addition to the inventory mentioned above. There may be a plurality of corresponding relationships between the dimensional information sets and the index values of a product. Taking the above example as an example, one of the correspondence between the dimensional information group of the jacket and the index value is the correspondence between the dimensional information group consisting of beijing, jacket, and ZZ and the stock 50; and the other is the corresponding relation of a dimension information group consisting of Beijing, the jacket and ZZ and the sales number of 100.
Taking some indexes and dimensions in the inventory index scenario as examples:
the corresponding relationship between the index and the dimension can be seen in Table 8
Figure GDA0002449160100000132
TABLE 8
After the changed index value is obtained, the target dimension information group corresponding to the index value can be determined.
Because the corresponding relation between the indexes and the dimensions is stored in the database, all the dimensions corresponding to the indexes can be determined according to the indexes corresponding to the obtained index values and the corresponding relation between the indexes and the dimensions.
And selecting a dimension information group matched with the target dimension information group from all dimension information groups corresponding to all dimensions.
For example, the obtained index is the stock 50, and the corresponding target dimension information group is beijing, jacket, and ZZ.
The dimensions corresponding to the inventory are location, commodity type and brand, each dimension of the location, the commodity type and the brand has respective dimension information, and the dimension information forms a dimension information group corresponding to the dimensions.
And finding out the dimension information group matched with Beijing, jacket and ZZ from all the dimension information groups corresponding to the places, the commodity types and the brands.
Specifically, the dimension information group identical to the target dimension information group is selected from the dimension information groups corresponding to all the determined dimensions.
For example, Beijing, jacket, and ZZ are in all the dimensional information groups corresponding to the location, commodity type, and brand; shanghai, jacket and ZZ; beijing, trousers, and ZZ; shanghai, jacket, and ZA.
And comparing the dimension information groups with the target dimension information groups respectively, and finally finding out matched dimension information groups, namely Beijing, jacket and ZZ.
And after the matched dimension information group is found, updating the index value corresponding to the selected dimension information group in the database by using the index value corresponding to the target dimension information group.
Specifically, according to the corresponding relation between the dimension information group and the index value, the index value corresponding to the selected dimension information group in the database is determined;
and updating the determined index value by using the index value corresponding to the target dimension information group.
Because the dimension information group and the index value have a corresponding relation, if the index value changes, the index value corresponding to the dimension information group matched with the target dimension information group is the acquired changed index value.
After the index value (which is equal to the index value corresponding to the matched dimension information group) corresponding to the target dimension information group in the database is updated, the real-time performance of the data in the database is realized.
Of course, sometimes it is not necessary to find a matching set of dimension information. For example, when a new product is added to the data system, the index value of the newly added product is obtained, and the database does not have a corresponding dimension information group, so that the matching is unsuccessful.
Optionally, if there is no dimension information group matching the target dimension information group in the dimension information groups corresponding to all the dimensions, the target dimension information is used as one dimension information group and added to the dimension information groups corresponding to all the dimensions, and a corresponding relationship between the dimension information group and a corresponding index value is established in the database.
For example: a commodity of 60 inches television is newly added in the data system, and the index value stock 1000 of the commodity of 60 inches television is obtained, and the corresponding target dimension information sets are Hangzhou, television and 60 inches.
The corresponding dimensions of the inventory are warehouse, commodity type and model.
Specific data can be found in table 9.
Storage house Kind of goods Model number
Beijing Television receiver 42 cun (42 cun)
Beijing Television receiver 46 inch (B)
Hangzhou province Television receiver 46 inch (B)
Hangzhou province Television receiver 50 inch thick
Shanghai province Television receiver 46 inch (B)
Hangzhou province Television receiver 42 cun (42 cun)
TABLE 9
All the dimension information sets corresponding to the warehouse, the commodity type and the model are shown in table 9, and the matching cannot be successful at this time.
If the matching is not successful, the Hangzhou, television and 60 inches can be used as a dimension information group, corresponding to the stock 1000, and added into the database.
The updated data can be seen in table 10.
Figure GDA0002449160100000151
Figure GDA0002449160100000161
Watch 10
Therefore, the matching can be successfully carried out when the inventory of the commodity of Hangzhou, television and 60 inches is changed and acquired next time, and the corresponding inventory value can be updated.
In implementation, in addition to adding the corresponding relationship between the dimension information set and the corresponding index value in the database, for some elements that do not need attention, the embodiments of the present disclosure may delete these elements.
Specifically, if a delete dimension command is received, the dimensions in the delete dimension command and the dimension information corresponding to the dimensions are deleted from the database.
For example, the dimension of the warehouse does not need to be concerned, the dimension "warehouse" and all the dimension information corresponding to the "warehouse" may be deleted.
Further, the same dimension information groups from which the dimension information is deleted may be combined, and index values corresponding to the dimension information groups may also be combined.
Taking table 11 as an example:
storage house Kind of goods Model number Stock quantity
Beijing Television receiver 42 cun (42 cun) 100
Beijing Television receiver 46 inch (B) 200
Hangzhou province Television receiver 46 inch (B) 100
Hangzhou province Television receiver 50 inch thick 200
Shanghai province Television receiver 46 inch (B) 150
Hangzhou province Television receiver 42 cun (42 cun) 320
Hangzhou province Television receiver 60 cun below the floor 480
TABLE 11
If the dimension warehouse is deleted, the dimension information groups are (television, 42 inches) (television, 46 inches) (television, 50 inches) (television, 60 inches), and the inventory quantities corresponding to the same dimension information groups are accumulated.
The merged table 11 becomes table 12:
kind of goods Model number Stock quantity
Television receiver 42 cun (42 cun) 400
Television receiver 46 inch (B) 450
Television receiver 50 inch thick 200
Television receiver 60 cun below the floor 480
TABLE 12
And if an index deleting command is received, deleting the indexes in the index deleting command, the dimension and the index value corresponding to the indexes and the dimension information corresponding to the dimension from the database.
For example, if the sales number does not need to be concerned, the sales number and the specific value corresponding to the sales number may be deleted, and all the dimensions corresponding to the sales number and the dimension information corresponding to all the dimensions may also need to be deleted.
Take table 8 as an example.
Assuming that the id of the index of the sales number is 1, deleting the index of the sales number means deleting the correspondence including the sales number in the correspondence in table 8. Table 8 after deletion becomes table 13.
Figure GDA0002449160100000171
Watch 13
Meanwhile, all the correspondence between the dimensional information group and the index value including the index value of the sales amount is deleted, for example, if the table 11 is the correspondence between the dimensional information group and the index value, the contents of the table 11 are all deleted.
A detailed flow example is provided below to illustrate aspects of the present disclosure.
As shown in fig. 2A, a detailed method for updating data according to an embodiment of the present disclosure includes:
step 201, determining a business data object (where the business data object may be inventory data).
Step 202, determining metadata of each index corresponding to the business data object.
Step 203, using the service data object, the metadata of the index and other parameters (such as cached commodity data, user information and the like) as the parameters of the dynamic scenario engine.
And step 204, determining the value of each index through the dynamic script engine.
Step 205, for one index, determine all dimensions corresponding to the index.
Step 206, determining dimension information of each dimension through the dynamic script engine.
Step 207, judging whether the dimension data corresponding to the obtained index value can be matched, if so, executing step 208; otherwise, step 209 is performed.
And step 208, updating the dimensional data, and ending the process.
And step 209, adding the corresponding relation between the data of the new dimension and the index value, and ending the flow.
Such as the user needing to add a "number of sales" indicator.
1. The user needs to define the index of sales number, and the corresponding index table has the following contents, specifically referring to table 14:
Figure GDA0002449160100000181
TABLE 14
2. The user needs to add the dimension related to "sales quantity", and the corresponding dimension table has the following contents, specifically referring to table 15:
Figure GDA0002449160100000182
Figure GDA0002449160100000191
watch 15
3. According to the indexes and dimensions established by the user, the corresponding relationship between the indexes and the dimensions can be established, and the corresponding index dimension correspondence table has the following contents, which is specifically referred to as table 16:
Figure GDA0002449160100000192
TABLE 16
4. Increasing a sales number index in a search interface;
5. when the business data changes, the data of the index of sales quantity and the corresponding dimension information are written into the index data table and the dimension data table, and meanwhile, the data related to the sales quantity are synchronized into the search.
Examples of index value and dimension information storage are table 17 and table 18:
Figure GDA0002449160100000193
TABLE 17
Figure GDA0002449160100000201
Watch 18
The user may search the interface for "sales volume" data.
All of the above definitions can be defined with the convenient UI provided, or can be done directly through the insert statement of the database.
In addition to providing an increase index, the embodiments of the present disclosure may also increase dimensionality.
Still take the "sales quantity" index as an example.
And adding a dimension related to the sales quantity in the dimension definition table, such as adding a userNick dimension. The corresponding table in dimension table can be as follows, see table 19:
Figure GDA0002449160100000202
Figure GDA0002449160100000211
watch 19
2. In the index dimension correspondence table, a correspondence between a new dimension and "sales quantity" is added, and the following contents are found in the index dimension correspondence table, which is specifically referred to in table 20:
Figure GDA0002449160100000212
watch 20
If the user needs to show the newly added dimension-related information on the UI, the UI needs to be modified synchronously.
In addition to the addition, the user may delete the indicator in embodiments of the present disclosure. In an actual scene, some indexes and dimensions may not need to be concerned and need to be deleted along with the change of the demand.
The following describes an embodiment of the present disclosure by taking a deletion index as an example, and a process of deleting a dimension is similar to a process of deleting an unread file and is not described herein again.
As shown in fig. 2B, a detailed method for deleting data in an embodiment of the disclosure includes:
step 211, receiving a delete index command.
Step 212, determining metadata of each index needing to be deleted in the delete index command.
Step 213, using the service data object, the metadata of the index, and other parameters (such as cached commodity data, user information, etc.) as the parameters of the dynamic scenario engine.
Step 214, determining the value of each index through the dynamic scenario engine.
Step 215, for one index, all dimensions corresponding to the index are determined.
And step 216, determining the dimension information of each dimension through the dynamic script engine.
Step 217, determining a corresponding relation containing the index needing to be deleted from the corresponding relation between the index and the dimension, and determining a corresponding relation containing the index value corresponding to the index needing to be deleted from the corresponding relation between the index value and the dimension information group;
and step 218, deleting the corresponding relation determined in step 217.
It should be noted that, in the embodiment of the present disclosure, in addition to all the corresponding relationships being determined to be deleted, the corresponding relationships may also be deleted after being determined.
Taking table 20 as an example, assume that the index "sales number" is to be deleted.
After receiving the delete index command of the user, the display of the index "sales quantity" is removed from the table 20 by modifying ui;
if id of index of sales number is 2, the table 20 excluding "sales number" is changed to the table 21.
Figure GDA0002449160100000221
TABLE 21
If the user needs to completely delete the indexes and the dimensionalities bound with the indexes, the definition of the 'sales quantity' indexes needs to be deleted from the index definition table, the dimensionalities related to the 'sales quantity' indexes are deleted from the dimensionality definition table, and the binding relation definition of the indexes and the dimensionalities is deleted from the index dimensionality corresponding table.
For example, if the dimension bound to the index "sales number" is "total stock" and id is 103, the dimension "total stock" in table 18 and table 19 is deleted, the deleted table 18 becomes table 22, and table 19 becomes table 23:
Figure GDA0002449160100000222
TABLE 22
Figure GDA0002449160100000231
TABLE 23
In the above description, how to update the database is described, the embodiments of the present disclosure also provide a method for searching the database.
The method for searching the database according to the embodiment of the disclosure can search through the dimension and the index. In implementation, this may be done using the api of the search engine; the search engine can also be packaged to realize the grammar shielding search of the application layer, so that the search engine can be replaced or the DB is used for searching, and the upper layer can be ensured to be realized without any adaptive change.
In practice, if the DB is used for searching, all data may not be saved, which is to improve performance and reduce cost. For large data volumes, the performance requirements on the hardware are higher if all data is stored. An alternative is to save the data for a period of time, such as 3 months, or 6 months. Thus, for a small amount of data, the query function provided by the DB is directly utilized, and the query among multiple tables can be efficiently completed.
In implementation, a user can select and display an interested index from the existing indexes according to the condition of the user; according to the condition of the user, part or all of the dimensionalities corresponding to the indexes can be selected as the search condition; the above may also be combined for searching.
As shown in fig. 3, a method for searching a database according to an embodiment of the present disclosure includes:
step 301, receiving a search instruction containing search information, wherein the search information comprises dimension search information and/or index search information;
step 302, determining dimension information and indexes to be inquired in a database according to the search information;
step 303, determining a search result according to the dimension information and the index which need to be inquired.
When a user needs to query a certain index or dimension in the database, the user can select information needing to be queried.
The dimension search information comprises dimension and/or specific dimension information; the index search information includes a specific index.
The user can perform searches in various ways as desired.
Optionally, determining the dimension, the dimension information, and the index to be queried in the database according to the search information includes:
if the search information comprises dimension search information, according to the corresponding relation between the dimension and the index, taking the index corresponding to the dimension in the dimension search information as the index needing to be inquired, and taking the dimension information in the dimension search information as the dimension information needing to be inquired; or
And if the search information comprises index search information, according to the corresponding relation between the dimensionality and the index, taking the dimensionality corresponding to the index in the index search information as the dimensionality needing to be inquired, and taking the dimensionality information corresponding to the dimensionality needing to be inquired as the dimensionality information needing to be inquired.
The following are examples.
1. The search information comprises dimension search information.
Such as the number of 42 "televisions that the user would like to search through all of the repositories, then the dimensions and dimension information is included in the dimension search information. The multiple dimensions are commodity type and commodity model respectively; the multiple dimension information is television and 42 inches, respectively.
Firstly, determining the index corresponding to each dimension according to the corresponding relation between the dimension and the index.
Take Table 24 as an example
Figure GDA0002449160100000241
Figure GDA0002449160100000251
Watch 24
The index to be queried can be determined from table 24 as total inventory and sales volume.
And dimension information corresponding to the dimension to be queried, namely television and 42 inches dimension information to be queried.
2. The search information includes index search information.
Such as: if the user wants to search the total inventory, the index search information includes the total inventory and has no dimension search information.
And after the index search information is received, taking the dimension corresponding to the index in the index search information as the dimension to be inquired according to the corresponding relation between the dimension and the index.
Taking table 24 as an example, it is determined that the dimensions corresponding to the total inventory are the commodity type and the commodity model according to the corresponding relationship between the dimensions and the index, and then the commodity type and the commodity model are used as the dimensions to be queried.
And after determining the dimension to be queried, taking dimension information corresponding to the dimension to be queried as the dimension information to be queried.
Taking table 12 as an example, the dimension information corresponding to the dimension "commodity category" to be queried is a television; the dimensions of the "commodity model" to be queried correspond to the dimension information of 42 inches, 46 inches, 50 inches and 60 inches. Then television, 42 inches, 46 inches, 50 inches and 60 inches are dimensional information that needs to be queried.
Optionally, the dimension information to be queried is grouped into at least one search dimension information group, where the dimension information included in each search dimension information group belongs to different dimensions, and each search dimension information group includes all the dimensions to be searched;
and aiming at a search dimension information group and an index needing to be inquired, selecting a dimension information group matched with the search dimension information group from the dimension information groups of all dimensions corresponding to the determined index, and taking the sum of index values corresponding to each selected dimension information group as a search result corresponding to the search dimension information group and the index.
In implementation, if the number of the dimension information to be queried is one, the dimension information is used as a search dimension information group.
If the number of the dimension information to be queried is multiple and each dimension corresponds to the same dimension, each dimension information is used as a search dimension information group, for example, the dimension information is Beijing, Shanghai and Hangzhou, and the corresponding dimension is a warehouse, and the Beijing, the Shanghai and the Hangzhou are respectively used as a search dimension information group.
If the dimension information needing to be inquired is multiple and corresponds to different dimensions, the dimension information is divided into different search dimension information groups. Such as warehouse, commodity category and model, the dimensions to be searched. The dimension information to be searched is Beijing, Hangzhou, television, 42 inches and 46 inches.
The search dimension information set includes the following:
beijing, TV, 42 cun;
beijing, TV, 46 cun;
hangzhou, TV, 42 inches;
hangzhou, TV, 46 cun.
After all the search dimension information groups are obtained, all the dimension information groups corresponding to the index are determined according to one search dimension information group and one index.
Taking the stock as an example, first all dimensions corresponding to the stock are determined, and then dimension information corresponding to all dimensions is determined.
All dimensions corresponding to the inventory can be seen in table 25.
Storage house Kind of goods Model number Stock keeping Number of pins
Beijing Television receiver 42 cun (42 cun) 100 50
Beijing Television receiver 46 inch (B) 200 80
Hangzhou province Television receiver 46 inch (B) 156 70
Hangzhou province Television receiver 50 inch thick 157 102
Beijing Jacket XTL 801 508
Hangzhou province Cap (hat) ZZL 456 156
TABLE 25
Based on table 11, the dimensions include warehouse, commodity category and model, and all corresponding dimension information sets include:
beijing, TV, 42 cun;
beijing, TV, 46 cun;
hangzhou, TV, 46 inches;
hangzhou, TV, 50 inches;
beijing, jacket, XT L;
hangzhou, hat, ZZ L.
After determining all the dimension information groups corresponding to the determined indexes, matching each search dimension information group with the dimension information group to find the matched dimension information group, and taking the sum of the index values corresponding to all the dimension information groups matched with the same search dimension information group as a search result.
Specifically, from the determined dimension information groups of all dimensions corresponding to the index, a dimension information group containing all dimension information in the search dimension information group in the database is selected.
For a search dimension information group, the dimension information group containing all the dimension information in the search dimension information group may be one; there may be a plurality of them, or none of them.
If the number of the index values is one, directly taking the index value corresponding to the matched dimension information group as a search result of the search dimension information group;
if the number of the index values is multiple, the sum of the index values corresponding to the matched dimension information groups is used as a search result of the search dimension information group;
if not, the default value is used as the search result of the search dimension information group.
For example, the searching dimension information group of Beijing, TV and 42 inches, the dimension information group matched with the searching dimension information group is the first one, and the corresponding stock index value is 100.
Such as warehouse and commodity categories, for example. The dimension information needing to be searched is Beijing and television, and the indexes are inventory and sale quantity.
The search dimension information group is beijing and television.
The dimension information group matched with the matched search dimension information group comprises:
beijing, TV, 42 cun;
beijing, TV, 46 cun;
hangzhou, TV, 46 inches;
hangzhou, TV, 50 cun.
Based on this, the search result of the inventory corresponding to the search dimension information group of beijing and television is 100+200+156+ 157-613;
the search result of the number of sales in the information group of the search dimension of beijing and television is 50+80+70+ 102-302.
It should be noted that the above tables 1 to 25 are merely examples for better understanding of the embodiments, and the form of the tables may be set as necessary.
Optionally, after determining search results corresponding to all the search dimension information groups and the indexes, displaying the search results in a search result display interface.
All the search results corresponding to the search dimension information groups and the indexes are combinations of each determined search dimension information group and each index, and the search results are determined in the above manner.
If the search dimension information groups a and B and the indexes 1 and 2 exist, the search results of the search dimension information group a and the index 1, the search dimension information group B and the index 1, the search dimension information group a and the index 2, and the search dimension information group B and the index 2 need to be determined, and then the search results can be displayed in a search result display interface.
The specific displayed search page can be subjected to interface design by the service scene of the user pattern; a plurality of display templates may be configured in advance, and a user may select which template is specifically used for display.
Optionally, the user may further set some self-defined index warning rules, for example, a warning of the marketable stock, and when the number of the marketable stock detected after the change is lower than the set threshold value, the user is notified in a preset warning manner, for example, the user may be notified in a short message, a telephone, a mail, or the like.
The embodiment of the disclosure accesses all stock data and the change of related data in real time, then converts the stock data into indexes and dimensions of the embodiment of the disclosure, and constructs an index structure of a search engine according to a designed search structure, so that index data can be acquired, inquired and counted in real time through various terminal interfaces through a search interface. Meanwhile, the user is supported to customize the entrance of the inventory early warning rule according to the index, and the replenishment and the allocation are checked.
In the current big data environment, for a business system, if the table structure of the database is frequently changed, many unpredictable risks are brought, such as: the table structure change may result in a locked table, causing temporary inaccessibility to the business system. Also for example: for most databases, the number of columns contained in a table is the most limited, and as the number of fields of a table increases, the amount of data recorded in a single row becomes larger and larger, which directly affects the performance of the database and sharply decreases. Also for example: frequent changes of the table structure increase the difficulty of establishing indexes for the database table, so that the query efficiency is very poor.
The embodiment of the disclosure effectively solves the problems through the model of indexes and dimensions. In the embodiment of the disclosure, the change of the service data only needs to correspondingly change the indexes, the dimensions and the corresponding relationship between the indexes and the dimensions, and the change of the fields of the table structure cannot be caused.
The embodiment of the disclosure searches through data, and compared with a database searching mode, the embodiment of the disclosure can increase searching objects, can enable the searching to be more flexible, and can improve efficiency and performance more stably under a big data environment.
When the existing database needs to increase and decrease the service data, the database, the application layer code and the interface need to be modified, and basically, the whole involved link needs to be modified from back to front. According to the embodiment of the disclosure, only the indexes and the dimensions need to be modified and updated, and only the corresponding relation needs to be compiled, so that modification of the core layer code of the database is avoided, and therefore, the development time and the test cost are shortened.
Based on the same disclosure concept, an apparatus for updating a database is also provided in the embodiments of the present disclosure, and because the principle of solving the problem of the apparatus is similar to the method for updating a database in the embodiments of the present disclosure, the implementation of the apparatus may refer to the implementation of the method, and repeated parts are not described again.
As shown in fig. 4, an apparatus for updating a database according to an embodiment of the present disclosure includes:
the processing module 400 is configured to obtain a changed index value from a data system corresponding to the index; determining a target dimension information group corresponding to each changed index value;
a dimension determining module 401, configured to determine all dimensions corresponding to the index in the database according to a corresponding relationship between the index and the dimensions;
a selecting module 402, configured to select a dimension information group matched with the target dimension information group from the dimension information groups corresponding to all the determined dimensions;
an updating module 403, configured to update the index value corresponding to the selected dimension information set in the database with the index value corresponding to the target dimension information set.
Optionally, the selecting module 402 is specifically configured to:
and selecting the dimension information group which is the same as the target dimension information group from the dimension information groups corresponding to all the determined dimensions.
Optionally, the updating module 403 is specifically configured to:
determining an index value corresponding to the selected dimension information group in the database according to the corresponding relation between the dimension information group and the index value;
and updating the determined index value by using the index value corresponding to the target dimension information group.
Optionally, the updating module 403 is further configured to:
and if the dimension information groups corresponding to all the dimensions do not have the dimension information group matched with the target dimension information group, taking the target dimension information as one dimension information group, adding the dimension information into the dimension information groups corresponding to all the dimensions, and establishing a corresponding relation between the dimension information group and the corresponding index value in the database.
Optionally, the processing module 400 is further configured to:
if a dimension deleting command is received, deleting the dimension in the dimension deleting command and the dimension information corresponding to the dimension from the database;
and if an index deleting command is received, deleting the indexes in the index deleting command, the dimension and the index value corresponding to the indexes and the dimension information corresponding to the dimension from the database.
Based on the same disclosure concept, the embodiment of the disclosure also provides a device for searching a database, and as the principle of solving the problem of the device is similar to the method for searching the database in the embodiment of the disclosure, the implementation of the device can refer to the implementation of the method, and repeated parts are not described again.
As shown in fig. 5, an apparatus for searching a database according to an embodiment of the present disclosure includes:
a receiving module 500, configured to receive a search instruction including search information, where the search information includes dimension search information and/or index search information;
a query information determining module 501, configured to determine, according to the search information, a dimension, dimension information, and an index that need to be queried in the database;
the search result determining module 502 is configured to determine a search result according to the dimension, the dimension information, and the index that need to be queried.
Optionally, the query information determining module 501 is specifically configured to:
if the search information comprises dimension search information, according to the corresponding relation between the dimension and the index, taking the index corresponding to the dimension in the dimension search information as the index needing to be inquired, and taking the dimension information in the dimension search information as the dimension information needing to be inquired; or
And if the search information comprises index search information, according to the corresponding relation between the dimensionality and the index, taking the dimensionality corresponding to the index in the index search information as the dimensionality needing to be inquired, and taking the dimensionality information corresponding to the dimensionality needing to be inquired as the dimensionality information needing to be inquired.
Optionally, the search result determining module 502 is specifically configured to:
forming at least one search dimension information group by using the dimension information to be inquired, wherein the dimension information included in each search dimension information group belongs to different dimensions, and each search dimension information group comprises all the dimensions to be searched;
and aiming at a search dimension information group and an index needing to be inquired, selecting a dimension information group matched with the search dimension information group from the dimension information groups of all dimensions corresponding to the determined index, and taking the sum of index values corresponding to each selected dimension information group as a search result corresponding to the search dimension information group and the index.
Optionally, the search result determining module 502 is specifically configured to:
and selecting a dimension information group containing all dimension information in the search dimension information group in the database from the determined dimension information groups of all dimensions corresponding to the indexes.
Optionally, the search result determining module 502 is further configured to:
and after determining the search results corresponding to all the search dimension information groups and indexes, displaying the search results in a search result display interface.
From the above, it can be seen that: when the database is updated, the embodiment of the disclosure acquires the changed index value from the data system corresponding to the index; determining a target dimension information group corresponding to each changed index value; determining all dimensions corresponding to the indexes in the database according to the corresponding relation between the indexes and the dimensions; selecting a dimension information group matched with the target dimension information group from the dimension information groups corresponding to all the determined dimensions; and updating the index value corresponding to the selected dimension information group in the database by using the index value corresponding to the target dimension information group.
Receiving a search instruction containing search information when searching a database, wherein the search information comprises dimension search information and/or index search information; determining dimensionality, dimensionality information and indexes needing to be inquired in a database according to the search information; and determining a search result according to the dimension, the dimension information and the index which need to be inquired.
Because the database of the embodiment of the disclosure is established through the indexes and the dimensions, when the specific service requirements are oriented, only the specific meanings of the indexes and the dimensions need to be modified, and redevelopment is not needed, so that the expansibility is improved.
The present application is described above with reference to block diagrams and/or flowchart illustrations of methods, apparatus (systems) and/or computer program products according to embodiments of the application. It will be understood that one block of the block diagrams and/or flowchart illustrations, and combinations of blocks in the block diagrams and/or flowchart illustrations, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, and/or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer and/or other programmable data processing apparatus, create means for implementing the functions/acts specified in the block diagrams and/or flowchart block or blocks.
Accordingly, the subject application may also be embodied in hardware and/or in software (including firmware, resident software, micro-code, etc.). Furthermore, the present application may take the form of a computer program product on a computer-usable or computer-readable storage medium having computer-usable or computer-readable program code embodied in the medium for use by or in connection with an instruction execution system. In the context of this application, a computer-usable or computer-readable medium may be any medium that can contain, store, communicate, propagate, or transport the program for use by or in connection with the instruction execution system, apparatus, or device.
It will be apparent to those skilled in the art that various changes and modifications can be made in the present disclosure without departing from the spirit and scope of the disclosure. Thus, if such modifications and variations of the present disclosure fall within the scope of the claims of the present disclosure and their equivalents, the present disclosure is also intended to encompass such modifications and variations.

Claims (16)

1. A method of updating a database, the method comprising:
acquiring the changed index value from the data system corresponding to the index; determining a target dimension information group corresponding to each changed index value;
determining all dimensions corresponding to the indexes in the database according to the corresponding relation between the indexes and the dimensions;
selecting a dimension information group matched with the target dimension information group from the dimension information groups corresponding to all the determined dimensions;
updating the index value corresponding to the selected dimension information group in the database by using the index value corresponding to the target dimension information group;
after the step of determining all dimensions corresponding to the index according to the corresponding relationship between the index and the dimensions, the method further includes:
and if the dimension information groups corresponding to all the dimensions do not have the dimension information group matched with the target dimension information group, taking the target dimension information as one dimension information group, adding the dimension information into the dimension information groups corresponding to all the dimensions, and establishing a corresponding relation between the dimension information group and the corresponding index value in the database.
2. The method of claim 1, wherein selecting a set of dimension information that matches the target set of dimension information from the determined sets of dimension information corresponding to all dimensions comprises:
and selecting the dimension information group which is the same as the target dimension information group from the dimension information groups corresponding to all the determined dimensions.
3. The method of claim 1, wherein updating the database for metric values corresponding to a set of target dimension information with metric values corresponding to the set of dimension information comprises:
determining an index value corresponding to the selected dimension information group in the database according to the corresponding relation between the dimension information group and the index value;
and updating the determined index value by using the index value corresponding to the target dimension information group.
4. A method according to any of claims 1 to 3, further comprising:
if a dimension deleting command is received, deleting the dimension in the dimension deleting command and the dimension information corresponding to the dimension from the database;
and if an index deleting command is received, deleting the indexes in the index deleting command, the dimension and the index value corresponding to the indexes and the dimension information corresponding to the dimension from the database.
5. A method of searching a database, the method comprising:
receiving a search instruction containing search information, wherein the search information comprises dimension search information and/or index search information;
determining dimensionality, dimensionality information and indexes needing to be inquired in a database according to the search information;
determining a search result according to the dimension, the dimension information and the index needing to be inquired;
wherein, the step of determining the search result according to the dimension, the dimension information and the index which need to be inquired comprises the following steps:
forming at least one search dimension information group by using the dimension information to be inquired, wherein the dimension information included in each search dimension information group belongs to different dimensions, and each search dimension information group comprises all the dimensions to be searched;
and aiming at a search dimension information group and an index needing to be inquired, selecting a dimension information group matched with the search dimension information group from the dimension information groups of all dimensions corresponding to the determined index, and taking the sum of index values corresponding to each selected dimension information group as a search result corresponding to the search dimension information group and the index.
6. The method of claim 5, wherein determining dimensions, dimension information, and metrics in the database that require querying based on the search information comprises:
if the search information comprises dimension search information, according to the corresponding relation between the dimension and the index, taking the index corresponding to the dimension in the dimension search information as the index needing to be inquired, and taking the dimension information in the dimension search information as the dimension information needing to be inquired; or
And if the search information comprises index search information, according to the corresponding relation between the dimensionality and the index, taking the dimensionality corresponding to the index in the index search information as the dimensionality needing to be inquired, and taking the dimensionality information corresponding to the dimensionality needing to be inquired as the dimensionality information needing to be inquired.
7. The method of claim 5, wherein selecting the set of dimension information in the database that matches the set of search dimension information from the set of dimension information for all dimensions corresponding to the determined metric comprises:
and selecting a dimension information group containing all dimension information in the search dimension information group in the database from the determined dimension information groups of all dimensions corresponding to the indexes.
8. The method according to any one of claims 5 to 7, wherein after the sum of the index values corresponding to each selected dimension information set is used as the search result corresponding to the search dimension information set and the index, the method further comprises:
and after determining the search results corresponding to all the search dimension information groups and indexes, displaying the search results in a search result display interface.
9. An apparatus for updating a database, the apparatus comprising:
the processing module is used for acquiring the changed index value from the data system corresponding to the index; determining a target dimension information group corresponding to each changed index value;
the dimension determining module is used for determining all dimensions corresponding to the indexes in the database according to the corresponding relation between the indexes and the dimensions;
the selection module is used for selecting a dimension information group matched with the target dimension information group from the dimension information groups corresponding to all the determined dimensions;
the updating module is used for updating the index value corresponding to the selected dimension information group in the database by using the index value corresponding to the target dimension information group;
wherein the update module is further configured to:
and if the dimension information groups corresponding to all the dimensions do not have the dimension information group matched with the target dimension information group, taking the target dimension information as one dimension information group, adding the dimension information into the dimension information groups corresponding to all the dimensions, and establishing a corresponding relation between the dimension information group and the corresponding index value in the database.
10. The device of claim 9, wherein the selection module is specifically configured to:
and selecting the dimension information group which is the same as the target dimension information group from the dimension information groups corresponding to all the determined dimensions.
11. The device of claim 9, wherein the update module is specifically configured to:
determining an index value corresponding to the selected dimension information group in the database according to the corresponding relation between the dimension information group and the index value;
and updating the determined index value by using the index value corresponding to the target dimension information group.
12. The apparatus of any of claims 9 to 11, wherein the processing module is further configured to:
if a dimension deleting command is received, deleting the dimension in the dimension deleting command and the dimension information corresponding to the dimension from the database;
and if an index deleting command is received, deleting the indexes in the index deleting command, the dimension and the index value corresponding to the indexes and the dimension information corresponding to the dimension from the database.
13. An apparatus for searching a database, the apparatus comprising:
the system comprises a receiving module, a searching module and a searching module, wherein the receiving module is used for receiving a searching instruction containing searching information, and the searching information comprises dimension searching information and/or index searching information;
the query information determining module is used for determining the dimension, the dimension information and the index which need to be queried in the database according to the search information;
the search result determining module is used for determining search results according to the dimension, the dimension information and the index which need to be inquired;
the search result determining module is specifically configured to:
forming at least one search dimension information group by using the dimension information to be inquired, wherein the dimension information included in each search dimension information group belongs to different dimensions, and each search dimension information group comprises all the dimensions to be searched;
and aiming at a search dimension information group and an index needing to be inquired, selecting a dimension information group matched with the search dimension information group from the dimension information groups of all dimensions corresponding to the determined index, and taking the sum of index values corresponding to each selected dimension information group as a search result corresponding to the search dimension information group and the index.
14. The device of claim 13, wherein the query information determination module is specifically configured to:
if the search information comprises dimension search information, according to the corresponding relation between the dimension and the index, taking the index corresponding to the dimension in the dimension search information as the index needing to be inquired, and taking the dimension information in the dimension search information as the dimension information needing to be inquired; or
And if the search information comprises index search information, according to the corresponding relation between the dimensionality and the index, taking the dimensionality corresponding to the index in the index search information as the dimensionality needing to be inquired, and taking the dimensionality information corresponding to the dimensionality needing to be inquired as the dimensionality information needing to be inquired.
15. The device of claim 13, wherein the search result determination module is specifically configured to:
and selecting a dimension information group containing all dimension information in the search dimension information group in the database from the determined dimension information groups of all dimensions corresponding to the indexes.
16. The apparatus of any of claims 13-15, wherein the search result determination module is further configured to:
and after determining the search results corresponding to all the search dimension information groups and indexes, displaying the search results in a search result display interface.
CN201610056622.5A 2016-01-27 2016-01-27 Method and equipment for updating and searching database Active CN107015987B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610056622.5A CN107015987B (en) 2016-01-27 2016-01-27 Method and equipment for updating and searching database

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610056622.5A CN107015987B (en) 2016-01-27 2016-01-27 Method and equipment for updating and searching database

Publications (2)

Publication Number Publication Date
CN107015987A CN107015987A (en) 2017-08-04
CN107015987B true CN107015987B (en) 2020-08-04

Family

ID=59439511

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610056622.5A Active CN107015987B (en) 2016-01-27 2016-01-27 Method and equipment for updating and searching database

Country Status (1)

Country Link
CN (1) CN107015987B (en)

Families Citing this family (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109165377A (en) * 2018-06-11 2019-01-08 玖富金科控股集团有限责任公司 Generate the method and tabulating equipment of form data
CN109086309B (en) * 2018-06-21 2022-12-30 土巴兔集团股份有限公司 Index dimension relation definition method, server and storage medium
CN109062946A (en) * 2018-06-21 2018-12-21 深圳市彬讯科技有限公司 It is a kind of to highlight method and device based on multiple web pages
CN109145110B (en) * 2018-06-29 2022-06-28 土巴兔集团股份有限公司 Label query method and device
CN109214640B (en) * 2018-07-02 2022-10-11 土巴兔集团股份有限公司 Method and device for determining index result and computer readable storage medium
CN109241075B (en) * 2018-07-02 2022-09-09 土巴兔集团股份有限公司 Index basic data processing method and equipment and computer readable storage medium
CN108959580A (en) * 2018-07-06 2018-12-07 深圳市彬讯科技有限公司 A kind of optimization method and system of label data
CN112765163A (en) * 2020-12-31 2021-05-07 蔚来汽车科技(安徽)有限公司 Data index storage method, system and device capable of extending dimensionality at will

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5905985A (en) * 1997-06-30 1999-05-18 International Business Machines Corporation Relational database modifications based on multi-dimensional database modifications
CN102750653A (en) * 2011-04-20 2012-10-24 中国南方电网有限责任公司 Method and system for performing multi-dimensional benchmarking analysis on electric power scheduling information
CN103390042A (en) * 2013-07-15 2013-11-13 长沙学院 Method and device for switching multi-dimensional cube
CN104408180A (en) * 2014-12-15 2015-03-11 北京国双科技有限公司 Stored data inquiring method and device
CN104408179A (en) * 2014-12-15 2015-03-11 北京国双科技有限公司 Method and device for processing data from data table

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5905985A (en) * 1997-06-30 1999-05-18 International Business Machines Corporation Relational database modifications based on multi-dimensional database modifications
CN102750653A (en) * 2011-04-20 2012-10-24 中国南方电网有限责任公司 Method and system for performing multi-dimensional benchmarking analysis on electric power scheduling information
CN103390042A (en) * 2013-07-15 2013-11-13 长沙学院 Method and device for switching multi-dimensional cube
CN104408180A (en) * 2014-12-15 2015-03-11 北京国双科技有限公司 Stored data inquiring method and device
CN104408179A (en) * 2014-12-15 2015-03-11 北京国双科技有限公司 Method and device for processing data from data table

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
基于数据仓库的数据搜索引擎实践;栾晓宇;《软件产业与工程》;20150510;52-56 *
栾晓宇.基于数据仓库的数据搜索引擎实践.《软件产业与工程》.2015,1-5. *

Also Published As

Publication number Publication date
CN107015987A (en) 2017-08-04

Similar Documents

Publication Publication Date Title
CN107015987B (en) Method and equipment for updating and searching database
CN108228817B (en) Data processing method, device and system
JP5721818B2 (en) Use of model information group in search
CN111459985B (en) Identification information processing method and device
JP5575902B2 (en) Information retrieval based on query semantic patterns
US8924373B2 (en) Query plans with parameter markers in place of object identifiers
US20220083618A1 (en) Method And System For Scalable Search Using MicroService And Cloud Based Search With Records Indexes
CN107992506B (en) Information processing method and device
WO2014145088A1 (en) Apparatus, systems, and methods for batch and realtime data processing
CN111339171B (en) Data query method, device and equipment
TW201214166A (en) Processing of categorized product information cross reference to other applications
CN111506559A (en) Data storage method and device, electronic equipment and storage medium
CN113220657B (en) Data processing method and device and computer equipment
CN112214505B (en) Data synchronization method, device, computer readable storage medium and electronic equipment
CN111414410A (en) Data processing method, device, equipment and storage medium
CN114741392A (en) Data query method and device, electronic equipment and storage medium
CN107291951B (en) Data processing method, device, storage medium and processor
CN111143356B (en) Report retrieval method and device
CN110765100B (en) Label generation method and device, computer readable storage medium and server
US20200364725A1 (en) Regulatory category assignment via machine learning
CN113934729A (en) Data management method based on knowledge graph, related equipment and medium
TWI547888B (en) A method of recording user information and a search method and a server
US11423098B2 (en) Method and apparatus to generate a simplified query when searching for catalog items
CN113780950A (en) Data processing method, device, server and readable storage medium
CN105159899A (en) Searching method and searching device

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
TA01 Transfer of patent application right
TA01 Transfer of patent application right

Effective date of registration: 20180418

Address after: Four story 847 mailbox of the capital mansion of Cayman Islands, Cayman Islands, Cayman

Applicant after: CAINIAO SMART LOGISTICS HOLDING Ltd.

Address before: Cayman Islands Grand Cayman capital building, a four storey No. 847 mailbox

Applicant before: ALIBABA GROUP HOLDING Ltd.

GR01 Patent grant
GR01 Patent grant