CN104516920B - Data query method and data query system - Google Patents

Data query method and data query system Download PDF

Info

Publication number
CN104516920B
CN104516920B CN201310463740.4A CN201310463740A CN104516920B CN 104516920 B CN104516920 B CN 104516920B CN 201310463740 A CN201310463740 A CN 201310463740A CN 104516920 B CN104516920 B CN 104516920B
Authority
CN
China
Prior art keywords
data
mark
identification
data identification
database
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.)
Expired - Fee Related
Application number
CN201310463740.4A
Other languages
Chinese (zh)
Other versions
CN104516920A (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.)
Peking University Founder Group Co Ltd
Beijing Founder Electronics Co Ltd
Original Assignee
Peking University Founder Group Co Ltd
Beijing Founder Electronics 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 Peking University Founder Group Co Ltd, Beijing Founder Electronics Co Ltd filed Critical Peking University Founder Group Co Ltd
Priority to CN201310463740.4A priority Critical patent/CN104516920B/en
Publication of CN104516920A publication Critical patent/CN104516920A/en
Application granted granted Critical
Publication of CN104516920B publication Critical patent/CN104516920B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/958Organisation or management of web site content, e.g. publishing, maintaining pages or automatic linking
    • 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/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor

Landscapes

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

Abstract

The present invention provides a kind of data query method and a kind of data query system, wherein, which includes:Identification request instruction according to receiving determines target data mark;According to preset time order by the Data Identification for criticizing the acquisition predetermined amount from database, and it is loaded into the first storage section, target data mark is inquired about in the first storage section, if inquire target data mark, it then obtains target data to identify and return, and terminates according to preset time order by the Data Identification for criticizing the acquisition predetermined amount from database;According to the mark selection instruction received, made choice in the target data mark got, and inquire about the corresponding data of Data Identification with choosing.It according to the technical solution of the application, can be needed article mark being loaded into caching in batches according to user, so as to avoid loading the time that mass data wasted and the influence to system performance in the buffer.

Description

Data query method and data query system
Technical field
The present invention relates to data query technique fields, are looked into particular to a kind of data query method and a kind of data Inquiry system.
Background technology
For general application, article is typically what is collectively formed by a part of word and plurality of pictures.In data The essential information of article and word are typically to be collectively stored in a table in storehouse, and this binary file of picture is then deposited In the file system outside database, the access mode of these pictures is only stored in data.
For above-mentioned storage organization, in general, the essential information of a certain number of articles can first be obtained in data access layer Then entity obtains all pictorial informations of each entity by linking the picture table of each entity, finally return to all complete Whole article entity.However this logical thinking is not appropriate for the exploitation of modern the Internet mobile application.Because this complexity of article Entity, when data reach 100,000, million, the speed for obtaining the entity of specified quantity is motive objects working application User is insupportable, and along with the limitation of the network access bandwidth of mobile equipment, speed accordingly will more slowly.
Above problem generally use the following two kinds mode is handled in correlation technique:
1. when application is first switched on, application program would generally load the entity of all articles among caching, When next client request article, directly paging and quick response are asked among caching.
2. loading the ID of all articles among caching, then according to the request of client, paging obtains one in buffering The article ID of series, finally obtains other details and pictorial information according to ID lists.
Above two method is all a kind of slowly access mechanism in the case of data magnanimity.As shown in Figure 1, Due to needing to load the entity of all articles or the ID for loading all articles into caching, exist when in pictorial information table 100000 articles, then may be data volume at double in picture table, in data up to a million find one record or Several records are a time-consuming operations.
The content of the invention
The present invention is based on the above problem, it is proposed that a kind of data query technique can be needed according to user by article Mark is loaded into caching in batches, so as to avoid loading time that mass data wasted in the buffer and to system performance Influence.
In view of this, the present invention proposes a kind of data query method, including:It is true according to the identification request instruction received Set the goal Data Identification;According to preset time order by obtaining the Data Identification of predetermined amount batch from database, and it is loaded into the The target data mark is inquired about in one storage section in the described first storage section, if inquiring the target data mark, It then obtains the target data to identify and return, and terminates and sequentially obtained according to the preset time by batch from the database The Data Identification of predetermined amount;According to the mark selection instruction received, made choice in the target data mark got, and The corresponding data of Data Identification inquired about and chosen.
In the technical scheme, for user when browsing news, what website was presented to user is multipage title, and user can root It determines to need the headline browsed according to page turning is needed(I.e. user sends identification request instruction), website is obtained from database first The title of a certain amount of latest news is taken to be loaded into caching, is then inquired about in the buffer with the presence or absence of the news mark needed for user Topic, if being not present, continues to obtain in the database(Compared with latest news)A certain amount of news of one period adds It is downloaded in caching, and is inquired about again from caching with the presence or absence of the headline needed for user, and so on, support inquires use Headline position needed for family.Since under normal circumstances, most users want that the news seen all is to tend to be several newest News, therefore need to only load newest part headline in the buffer and can meet the needs of most users, moreover, During news before user needs to browse the long period, corresponding headline can also be extracted from database to user, So as to also meet the demand of the user of special requirement.Simultaneously as each loading section news identifies in the buffer, pole The pressure of caching is alleviated in big degree, improves the reading speed and loading velocity of news mark.
In the above-mentioned technical solutions, it is preferable that pre- by the acquisition from the database is criticized according to preset time order If the step of Data Identification of amount, includes:When obtaining the farthest write-in in the database in the write time of each Data Identification Between and be most recently written the time, from corresponding to the Data Identification being most recently written corresponding to the time to the farthest write time Data Identification, by batch Data Identification of acquisition predetermined amount.
In the technical scheme, a certain amount of news mark is obtained every time, it can be according to the time from newest headline It is obtained to old headline, so as to improve the hit rate that user inquires about headline.
In the above-mentioned technical solutions, it is preferable that by it is described according to preset time order by obtaining batch from the database During the Data Identification of predetermined amount, the data corresponding to the Data Identification of the predetermined amount are inquired about in the database, and by institute It states the data corresponding to the Data Identification of predetermined amount and is loaded onto the second storage section.
In the technical scheme, when extracting news mark from database, while it is right to extract news mark institute The physical contents answered, and be loaded into another caching, it may when so as to avoid extraction physical contents and extracting title The interference of generation.
In the above-mentioned technical solutions, it is preferable that after target data mark is got, further include:According to the mesh got Each Data Identification in Data Identification is marked, inquiry is identified with each target data in the described second storage section distinguishes Corresponding data, and the data inquired are loaded onto in for use list and, will not inquire the data mark of corresponding data Knowledge is stored to the presets list;Each Data Identification in described the presets list, from the database extraction with it is described pre- If the corresponding data of each Data Identification in list, and the data extracted are loaded onto in for use list;Then When receiving the mark selection instruction, inquiry and the corresponding number of Data Identification chosen from for use list According to.
In the technical scheme, for not inquiring the mark of corresponding data, storage can be unified in a list, treated After the mark that corresponding data can be inquired is disposed, the disposably extraction pair from database further according to the mark in list Data are answered, less than the mark of corresponding data to be returned to database extraction corresponding for inquiry in another caching without often running into one Data, improve data query and extraction efficiency.
In any of the above-described technical solution, it is preferable that default by the acquisition from database is criticized according to preset time order During the Data Identification of amount, judge in the data corresponding to the Data Identification of the predetermined amount with the presence or absence of picture, if in the presence of obtaining The attribute information of the picture is taken, is stored the picture to default file according to the attribute information, and described corresponding Retain the attribute information in data;And inquire with after the corresponding data of the Data Identification chosen, judge with The no attribute information there are picture in the corresponding data of Data Identification chosen, if in the presence of according to attribute letter Breath obtains picture from the default file, and added to in the corresponding data of the Data Identification chosen.
In the technical scheme, during headline is extracted from database, if identifying in corresponding data Include picture, then can be stored in picture in the file specified according to the attribute information of picture, while by the attribute of picture Information is retained in corresponding data.When user chooses some headline, if being wrapped in data corresponding to the headline Attribute information containing picture, it is possible to which the path directly formed according to the attribute information is got accordingly in specified file Picture, reduce and picture stored by way of link, and parsing links consumed time when extracting picture.
The application also proposed a kind of data query system, including:Determination unit is identified, for according to the mark received Request instruction determines that target data identifies;Loading unit, according to preset time order by obtaining predetermined amount batch from database Data Identification, and it is loaded into the first storage section;Query unit is identified, for inquiring about the mesh in the described first storage section Data Identification is marked, if inquiring the target data mark, the target data is obtained and identifies and return, and terminate described add Carrier unit is according to preset time order by the Data Identification for criticizing the acquisition predetermined amount from the database;Data query list Member, for according to the mark selection instruction received, making choice, and being inquired about with choosing in the target data mark got The corresponding data of Data Identification.
In the technical scheme, for user when browsing news, what website was presented to user is multipage title, and user can root It determines to need the headline browsed according to page turning is needed(I.e. user sends identification request instruction), website is obtained from database first The title of a certain amount of latest news is taken to be loaded into caching, is then inquired about in the buffer with the presence or absence of the news mark needed for user Topic, if being not present, continues to obtain in the database(Compared with latest news)A certain amount of news of one period adds It is downloaded in caching, and is inquired about again from caching with the presence or absence of the headline needed for user, and so on, support inquires use Headline position needed for family.Since under normal circumstances, most users want that the news seen all is to tend to be several newest News, therefore need to only load newest part headline in the buffer and can meet the needs of most users, moreover, During news before user needs to browse the long period, corresponding headline can also be extracted from database to user, So as to also meet the demand of the user of special requirement.Simultaneously as each loading section news identifies in the buffer, pole The pressure of caching is alleviated in big degree, improves the reading speed and loading velocity of news mark.
In the above-mentioned technical solutions, it is preferable that the loading unit includes:Time acquisition unit, for obtaining the number According to the farthest write time in the write time of each Data Identification in storehouse and it is most recently written the time;Mark acquiring unit is used for From the Data Identification corresponding to the Data Identification being most recently written corresponding to the time to the farthest write time, obtained by batch The Data Identification of predetermined amount.
In the technical scheme, a certain amount of news mark is obtained every time, it can be according to the time from newest headline It is obtained to old headline, so as to improve the hit rate that user inquires about headline.
In the above-mentioned technical solutions, it is preferable that the loading unit is additionally operable to, by it is described according to preset time order by batch When the Data Identification of predetermined amount is obtained from the database, the Data Identification institute of the predetermined amount is inquired about in the database Corresponding data, and the data corresponding to the Data Identification of the predetermined amount are loaded onto the second storage section.
In the technical scheme, when extracting news mark from database, while it is right to extract news mark institute The physical contents answered, and be loaded into another caching, it may when so as to avoid extraction physical contents and extracting title The interference of generation.
In the above-mentioned technical solutions, it is preferable that further include:Extraction unit, wherein, the data query unit is additionally operable to root According to each Data Identification in the target data mark got, inquiry and each target in the described second storage section The corresponding data of Data Identification;The data that the loading unit is additionally operable to inquire be loaded onto in for use list and, The Data Identification for not inquiring corresponding data is stored to the presets list;The extraction unit is used for according to described the presets list In each Data Identification, corresponding with each Data Identification in described the presets list number is extracted from the database According to, and the data extracted are loaded onto in for use list;And the data query unit is receiving the mark During selection instruction, inquiry and the corresponding data of Data Identification chosen from for use list.
In the technical scheme, for not inquiring the mark of corresponding data, storage can be unified in a list, treated After the mark that corresponding data can be inquired is disposed, the disposably extraction pair from database further according to the mark in list Data are answered, less than the mark of corresponding data to be returned to database extraction corresponding for inquiry in another caching without often running into one Data, improve data query and extraction efficiency.
In the above-mentioned technical solutions, it is preferable that further include:Image store, the loading unit according to it is default when Between order by the Data Identification that predetermined amount is obtained batch from database when, judge the number corresponding to the Data Identification of the predetermined amount With the presence or absence of picture in, if in the presence of obtaining the attribute information of the picture, deposited the picture according to the attribute information Storage retains the attribute information to default file in the corresponding data;Judging unit, in the data query Unit is being inquired with after the corresponding data of the Data Identification chosen, judging corresponding with the Data Identification chosen Data in the no attribute information there are picture, if in the presence of figure is obtained from the default file according to the attribute information Piece, and added to in the corresponding data of the Data Identification chosen.
In the technical scheme, during headline is extracted from database, if identifying in corresponding data Include picture, then can be stored in picture in the file specified according to the attribute information of picture, while by the attribute of picture Information is retained in corresponding data.When user chooses some headline, if being wrapped in data corresponding to the headline Attribute information containing picture, it is possible to which the path directly formed according to the attribute information is got accordingly in specified file Picture, reduce and picture stored by way of link, and parsing links consumed time when extracting picture.
By above technical scheme, can be needed article mark being loaded into caching in batches according to user, so as to avoid The time that loading mass data is wasted in the buffer and the influence to system performance.
Description of the drawings
Fig. 1 shows the schematic diagram that data are stored in correlation technique;
Fig. 2 shows the schematic flow diagram of data query method according to an embodiment of the invention;
Fig. 3 shows the schematic block diagram of data query system according to an embodiment of the invention;
Fig. 4 shows the schematic diagram of storage data according to an embodiment of the invention;
Fig. 5 shows the schematic diagram of storage picture according to an embodiment of the invention.
Specific embodiment
It is to better understand the objects, features and advantages of the present invention, below in conjunction with the accompanying drawings and specific real Mode is applied the present invention is further described in detail.It should be noted that in the case where there is no conflict, the implementation of the application Feature in example and embodiment can be mutually combined.
Many details are elaborated in the following description to facilitate a thorough understanding of the present invention, still, the present invention may be used also To be implemented using other different from other modes described here, therefore, protection scope of the present invention and from described below Specific embodiment limitation.
Fig. 2 shows the schematic flow diagram of data query method according to an embodiment of the invention.
As shown in Fig. 2, data query method according to an embodiment of the invention includes:Step 102, according to the mark received Know request instruction and determine that target data identifies;Step 104, according to preset time order by obtaining predetermined amount batch from database Data Identification, and the first storage section is loaded into, target data mark is inquired about in the first storage section, if inquiring number of targets It according to mark, then obtains target data and identifies and return, and terminate default by the acquisition from database is criticized according to preset time order The Data Identification of amount;Step 106, according to the mark selection instruction received, selected in the target data mark got It selects, and inquires about the corresponding data of Data Identification with choosing.
For user when browsing news, what website was presented to user is multipage title, and user can determine in page turning as needed Need the headline browsed(I.e. user sends identification request instruction), website obtains a certain amount of newest from database first The title of news is loaded into caching, then inquires about the headline that whether there is needed for user in the buffer, if being not present, Continue to obtain in the database(Compared with latest news)A certain amount of news of one period is loaded into caching, and again The secondary inquiry from caching is with the presence or absence of the headline needed for user, and so on, it supports to inquire the news mark needed for user Inscribe position.Since under normal circumstances, most users want that the news seen all is to tend to newest several news, therefore are caching In only need to load newest part headline and can meet the needs of most users, moreover, needing to browse in user During news before the long period, corresponding headline can also be extracted from database to user, so as to also meet The demand of the user of special requirement.Simultaneously as each loading section news identifies in the buffer, largely alleviate The pressure of caching improves the reading speed and loading velocity of news mark.
Preferably, step 104 includes:Obtain the farthest write time in the write time of each Data Identification in database Be most recently written the time, from the Data Identification corresponding to the Data Identification being most recently written corresponding to the time to farthest write time, By batch Data Identification of acquisition predetermined amount.
A certain amount of news mark is obtained every time, can be obtained according to the time from newest headline to old headline It takes, so as to improve the hit rate that user inquires about headline.
Preferably, when according to preset time order by the Data Identification that predetermined amount is obtained from database is criticized, in data The data corresponding to the Data Identification of predetermined amount are inquired about in storehouse, and the data corresponding to the Data Identification of predetermined amount are loaded onto the Two storage sections.
When extracting news mark from database, while the corresponding physical contents of news mark can also be extracted, and It is loaded into another caching, so as to avoid issuable interference when extraction physical contents and extraction title.
Preferably, after target data mark is got, further include:It is each in the target data mark got Data Identification, inquiry and each target data identify corresponding data, and the number that will be inquired in the second storage section And, the Data Identification for not inquiring corresponding data is stored to the presets list according to being loaded onto in for use list;According to default Each Data Identification in list extracts data corresponding with each Data Identification in the presets list from database, And the data extracted are loaded onto in for use list;Then receive mark selection instruction when, from for use list inquiry with The corresponding data of Data Identification chosen.
For not inquiring the mark of corresponding data, storage can be unified in a list, treat can to inquire pair After the mark of data is answered to be disposed, corresponding data is disposably extracted from database further according to the mark in list, without Often run into one in another caching inquiry be returned to database less than the mark of corresponding data and extract corresponding data, improve Data query and the efficiency of extraction.
Preferably, when according to preset time order by the Data Identification that predetermined amount is obtained from database is criticized, judge pre- If with the presence or absence of picture in data corresponding to the Data Identification of amount, if in the presence of the attribute information of picture being obtained, according to attribute Information stores picture to default file, and the reserved property information in corresponding data;And in the number for inquiring and choosing After corresponding data are identified, judge and the corresponding data of Data Identification chosen in the no attribute information there are picture, If in the presence of, picture is obtained from default file according to attribute information, and added to the corresponding number of Data Identification with choosing In.
During headline is extracted from database, include picture if identifying in corresponding data, it can Picture is stored in the file specified, while the attribute information of picture is retained in corresponding with the attribute information according to picture In data.When user chooses some headline, if including the attribute letter of picture in data corresponding to the headline Breath, it is possible to which the path directly formed according to the attribute information gets corresponding picture in specified file, reduces logical The mode for crossing link stores picture, and parsing links the consumed time when extracting picture.
Fig. 3 shows the schematic block diagram of data query system according to an embodiment of the invention.
As shown in figure 3, data query system 200 according to an embodiment of the invention includes:Determination unit 202 is identified, is used According to the definite target data mark of the identification request instruction received;Loading unit 204, according to preset time order by batch from The Data Identification of predetermined amount is obtained in database, and is loaded into the first storage section;Query unit 206 is identified, for first It stores and target data mark is inquired about in section, if inquiring target data mark, obtain target data and identify and return, and eventually Only loading unit 204 according to preset time order by the Data Identification that predetermined amount is obtained batch from database;Data query unit 208, for according to the mark selection instruction received, being made choice in the target data mark got, and inquiring about and select In the corresponding data of Data Identification.
For user when browsing news, what website was presented to user is multipage title, and user can determine in page turning as needed Need the headline browsed(I.e. user sends identification request instruction), website obtains a certain amount of newest from database first The title of news is loaded into caching, then inquires about the headline that whether there is needed for user in the buffer, if being not present, Continue to obtain in the database(Compared with latest news)A certain amount of news of one period is loaded into caching, and again The secondary inquiry from caching is with the presence or absence of the headline needed for user, and so on, it supports to inquire the news mark needed for user Inscribe position.Since under normal circumstances, most users want that the news seen all is to tend to newest several news, therefore are caching In only need to load newest part headline and can meet the needs of most users, moreover, needing to browse in user During news before the long period, corresponding headline can also be extracted from database to user, so as to also meet The demand of the user of special requirement.Simultaneously as each loading section news identifies in the buffer, largely alleviate The pressure of caching improves the reading speed and loading velocity of news mark.
Preferably, loading unit 204 includes:Time acquisition unit 2042, for obtaining each Data Identification in database Write time in the farthest write time and be most recently written the time;Mark acquiring unit 2044, for from being most recently written the time Data Identification corresponding to corresponding Data Identification to farthest write time, by batch Data Identification of acquisition predetermined amount.
A certain amount of news mark is obtained every time, can be obtained according to the time from newest headline to old headline It takes, so as to improve the hit rate that user inquires about headline.
Preferably, loading unit 204 is additionally operable to, according to preset time order by obtaining predetermined amount batch from database During Data Identification, the data corresponding to the Data Identification of predetermined amount are inquired about in the database, and by the Data Identification institute of predetermined amount Corresponding data are loaded onto the second storage section.
When extracting news mark from database, while the corresponding physical contents of news mark can also be extracted, and It is loaded into another caching, so as to avoid issuable interference when extraction physical contents and extraction title.
Preferably, further include:Extraction unit 210, wherein, data query unit 208 is additionally operable to according to the target got Each Data Identification in Data Identification, inquiry and each target data identify corresponding number in the second storage section According to;The data that loading unit 204 is additionally operable to inquire be loaded onto in for use list and, corresponding data will not inquired Data Identification store to the presets list;Extraction unit 210 is for each Data Identification in the presets list, from database It is middle to extract data corresponding with each Data Identification in the presets list, and the data extracted are loaded onto for use list In;And data query unit 208 is when receiving mark selection instruction, the Data Identification inquiring about and choose from for use list Corresponding data.
For not inquiring the mark of corresponding data, storage can be unified in a list, treat can to inquire pair After the mark of data is answered to be disposed, corresponding data is disposably extracted from database further according to the mark in list, without Often run into one in another caching inquiry be returned to database less than the mark of corresponding data and extract corresponding data, improve Data query and the efficiency of extraction.
Preferably, further include:Image store 212, in loading unit 204 according to preset time order by batch from data When the Data Identification of predetermined amount is obtained in storehouse, judge with the presence or absence of picture in the data corresponding to the Data Identification of predetermined amount, if In the presence of then obtaining the attribute information of picture, stored picture to default file according to attribute information, and protected in corresponding data Stay attribute information;Judging unit 214, for corresponding in the Data Identification for inquiring and choosing in data query unit 208 After data, judge and the corresponding data of Data Identification chosen in the no attribute information there are picture, if in the presence of according to category Property information obtain picture from default file, and added in the corresponding data of Data Identification with choosing.
During headline is extracted from database, include picture if identifying in corresponding data, it can Picture is stored in the file specified, while the attribute information of picture is retained in corresponding with the attribute information according to picture In data.When user chooses some headline, if including the attribute letter of picture in data corresponding to the headline Breath, it is possible to which the path directly formed according to the attribute information gets corresponding picture in specified file, reduces logical The mode for crossing link stores picture, and parsing links the consumed time when extracting picture.
It should be noted that above-mentioned first storage section and the second storage section, except including caching, can also be other The storage section of type, such as ROM, flash memory etc..Also, above-mentioned Data Identification can also include each except including headline Kind other kinds of Data Identification, such as the title of article, title of each chapters and sections etc. in books.
Fig. 4 shows the schematic diagram of storage data according to an embodiment of the invention.
As shown in figure 4, it is first switched in user in application, such as opening has data query system as shown in Figure 2 During 200 website, website can analyze the screen message of the terminal of user, for example the user is using mobile phone, is 11 for font size News mark most multipotency accommodates 20, then website can obtain 100 news marks from database, and be loaded into memory block Between in, newest 20 news mark is then obtained from storage section and is presented to user, user can turn over backward as needed Page, such as user need browsing page three news mark, i.e., the the 41st to the 60th news identifies, then website can be quickly from depositing The the 41st to the 60th news mark is extracted between storage area and is presented to user.For page turn over operation of the user at first page 5, website all may be used With from storage section rapid extraction go out corresponding news mark and be presented to user.
And when user inquires about the news mark after page 5, such as the news mark of inquiry page 12, then it website can The temporally adjacent of write-in database is identified with above-mentioned 100 news to be extracted from database, and the time for writing database is early In the other 100 news mark of above-mentioned 100 news mark.For example newest news identification number is 1, then website is initial It only loads news of the sequence number from 1 to 100 to be identified in storage section, when user inquires about the news mark of page 12, it is possible to News mark of the sequence number from 101 to 200 is extracted from database, is loaded into storage section, due to the 12nd news mark also It identifies, can not be inquired in news mark of the sequence number from 101 to 200 corresponding new from 221 to 240 news corresponding to sequence number It hears mark, then continues to extract sequence number in the database from 201 to 300 Data Identification, and be loaded into storage section, then it can be with The Data Identification needed for user is inquired in section is stored.
Since under normal circumstances, most users are only to newest(It is i.e. nearest apart from current point in time)News it is interested, If all news mark in database is all loaded into storage section, identified for the news in storage section, Yong Huke Can only consult it is a little, so as to which storage section resource is caused and greatly wasted.Therefore can only load newest Several news be identified to storage section in, without by database all news mark all be loaded into storage section In, on the one hand meet the needs of most users, improve user and identified by terminal inquiry news, it on the other hand can be to avoid net The storage section resource stood is by excessive occupancy.
The size for storing section is dynamic change as needed.X represents storage section increased step-length every time, X roots Suitable data are taken according to page-size in paging, it generally should not be too big.The storage section of this dynamic size can effectively be protected It demonstrate,proves to the quick corresponding of client request, and it may ensure that the influence that speed is brought from the increase of total amount of data, is suitble to The long-run development of application.On the other hand, for the storage section size X in step A value, it is necessary to ensure depositing for X datas It disclosure satisfy that the demand of in most cases client between storage area, reducing requested database increases the number of storage section size.
When news mark is loaded into storage section, each news can also be identified corresponding article entity and loaded To another storage section(I.e. second storage section)In, thus after the mark of the news needed for user is inquired, it can be by this The corresponding article entity of mark is extracted in known article list from another storage section for use, when user chooses some a bit When news identifies, it is possible to which rapid extraction goes out the corresponding article entity of mark chosen and is presented to use from another storage section Family since the loading of article entity is in another storage section, avoids the issuable interference in extraction mark and entity.
Corresponding data are being inquired about according to Data Identification(Entity)When, it may be possible to it inquires, it is also possible to inquire about less than right In the mark that can not inquire about corresponding data, can be stored to unknown article ID lists(That is the presets list)In, Ran Houzai After having handled all Data Identifications, all Data Identifications that can not inquire corresponding data are just stored in unknown article ID In list, and then corresponding data are extracted from database further according to the Data Identification in list is unified, avoid cyclic query Each unknown article ID to extract article entity from database, but disposably looked by a unknown article ID list It askes database and obtains an article list of entities, improve the efficiency of data query and extraction, reduce the inquiry time of database Number.
In order to simplify picture storage mode, glue file catalogue may be employed(That is default file)Store picture file, Use article and/or some attribute names of picture these picture files formation path.So as to when obtaining picture, it is possible to After the essential information of acquisition article just, the picture for accessing needs according to I/O is directly passed through in code.For example, picture can be with It is named with following modes:
[article ID] _ [width] _ [height] _ [column ID] _ [key] .Jpg
[article ID] and [column ID] therein can be the attribute information or picture itself of article where picture Attribute information(That is the ID of the ID of the affiliated article of picture and article place column), [width] and [height] therein can refer to Location information of the picture in article or refer to the attribute information of article itself, wherein [key] is partly stored in text A character string generated at random in chapter Basic Information Table, it is only stored in the database day after tomorrow to server-side application It uses, is not exposed to user terminal, be used for protecting the secure access of picture with this, avoid being brought by this fixed naming rule Safety problem.On the other hand, the information on picture in itself can be stored directly in the metamessage domain of picture.Digital picture In addition to storing Pixel Information, some additional informations can also be added, for example picture is marked on a map, is described, author, creation time Deng.In the application, by related API can very aspect customization and access these information, without using in the database The chain that these information are stored in an individual table and are parsed in article fetches acquisition picture.
Through the above way to store picture, reduce the number for accessing data and include mass picture information at one One or plurality of pictures information the time it takes are indexed in table.It, can be in file system by some unique attributes Picture is divided into several catalogues, as shown in figure 5, the catalogue storage of such as one column ID name is all under this column The picture that article generates only stores pictures of the article ID between 1000 to 10000 with the 1000_10000 catalogues named, these The speed that can greatly reduce one pictures of search is used in combination in mode.
It finally, will be from the data corresponding to the second Data Identification for extracting of storage section and according in the presets list The unified data inquired from database of Data Identification are merged into for use list, and according to initially being obtained from database When each data corresponding to order ID the data in for use list are ranked up, with ensure article entity user terminal into The correct display of row.
Technical scheme is described in detail above in association with attached drawing, it is contemplated that in correlation technique, when user is into networking During browsing data of standing, all Data Identifications or all data entities can be loaded into caching by website, and actually user Required simply writes time newest small part content, therefore can cause the waste of cache resources and system operation speed Degree reduces.By the technical solution of the application, can be needed article mark being loaded into caching in batches according to user, so as to keep away Exempt to load the time that mass data wasted and the influence to system performance in the buffer.
It should be understood by those skilled in the art that, the embodiment of the present invention can be provided as method, system or computer program Product.Therefore, the reality in terms of complete hardware embodiment, complete software embodiment or combination software and hardware can be used in the present invention Apply the form of example.Moreover, the computer for wherein including computer usable program code in one or more can be used in the present invention Usable storage medium(Including but not limited to magnetic disk storage, CD-ROM, optical memory etc.)The computer program production of upper implementation The form of product.
The present invention be with reference to according to the method for the embodiment of the present invention, equipment(System)And the flow of computer program product Figure and/or block diagram describe.It should be understood that it can be realized by computer program instructions every first-class in flowchart and/or the block diagram The combination of flow and/or box in journey and/or box and flowchart and/or the block diagram.These computer programs can be provided The processor of all-purpose computer, special purpose computer, Embedded Processor or other programmable data processing devices is instructed to produce A raw machine so that the instruction performed by computer or the processor of other programmable data processing devices is generated for real The device for the function of being specified in present one flow of flow chart or one box of multiple flows and/or block diagram or multiple boxes.
These computer program instructions, which may also be stored in, can guide computer or other programmable data processing devices with spy Determine in the computer-readable memory that mode works so that the instruction generation being stored in the computer-readable memory includes referring to Make the manufacture of device, the command device realize in one flow of flow chart or multiple flows and/or one box of block diagram or The function of being specified in multiple boxes.
These computer program instructions can be also loaded into computer or other programmable data processing devices so that counted Series of operation steps is performed on calculation machine or other programmable devices to generate computer implemented processing, so as in computer or The instruction offer performed on other programmable devices is used to implement in one flow of flow chart or multiple flows and/or block diagram one The step of function of being specified in a box or multiple boxes.
In the present invention, term " first ", " second " are only used for description purpose, and it is not intended that instruction or hint are opposite Importance.Term " multiple " refers to two or more, unless otherwise restricted clearly.
The foregoing is only a preferred embodiment of the present invention, is not intended to limit the invention, for the skill of this field For art personnel, the invention may be variously modified and varied.Within the spirit and principles of the invention, that is made any repaiies Change, equivalent substitution, improvement etc., should all be included in the protection scope of the present invention.

Claims (6)

  1. A kind of 1. data query method, which is characterized in that including:
    Identification request instruction according to receiving determines target data mark;
    According to preset time order by obtaining the Data Identification of predetermined amount batch from database, and the first storage section is loaded into, The target data mark is inquired about in the described first storage section, if inquiring the target data mark, described in acquisition Target data is identified and returned, and is terminated according to preset time order by the number for criticizing the acquisition predetermined amount from the database According to mark;
    According to the mark selection instruction received, made choice in the target data mark got, and inquire about and choose The corresponding data of Data Identification;
    By it is described according to preset time order by the Data Identification that predetermined amount is obtained batch from the database when, in the data The data corresponding to the Data Identification of the predetermined amount, and the data corresponding to by the Data Identification of the predetermined amount are inquired about in storehouse It is loaded onto the second storage section;
    After target data mark is got, further include:
    According to each Data Identification in the target data mark got, inquired about in the described second storage section and described every A target data identifies corresponding data, and the data inquired are loaded onto in for use list and, will not inquire The Data Identification of corresponding data is stored to the presets list;
    Each Data Identification in described the presets list, from the database extraction with it is each in described the presets list The corresponding data of Data Identification, and the data extracted are loaded onto in for use list;Then
    When receiving the mark selection instruction, inquired about from for use list corresponding with the Data Identification chosen Data.
  2. 2. data query method according to claim 1, which is characterized in that according to preset time order by batch from institute The step of stating the Data Identification that predetermined amount is obtained in database includes:
    It obtains the farthest write time in the database in the write time of each Data Identification and is most recently written the time, from institute The Data Identification being most recently written corresponding to the Data Identification corresponding to the time to the farthest write time is stated, it is default by batch acquisition The Data Identification of amount.
  3. 3. data query method according to claim 1 or 2, which is characterized in that according to preset time order by batch from When obtaining the Data Identification of predetermined amount in database, judge to whether there is in the data corresponding to the Data Identification of the predetermined amount Picture, if in the presence of obtaining the attribute information of the picture, stored the picture to default text according to the attribute information Part, and retain the attribute information in the corresponding data;And
    It is inquiring with after the corresponding data of the Data Identification chosen, judging corresponding with the Data Identification chosen Data in the no attribute information there are picture, if in the presence of figure is obtained from the default file according to the attribute information Piece, and added to in the corresponding data of the Data Identification chosen.
  4. 4. a kind of data query system, which is characterized in that including:
    Determination unit is identified, for determining target data mark according to the identification request instruction received;
    Loading unit according to preset time order by obtaining the Data Identification of predetermined amount batch from database, and is loaded into first Store section;
    Query unit is identified, for inquiring about the target data mark in the described first storage section, if inquiring the mesh Data Identification is marked, then obtains the target data and identifies and return, and it is suitable according to the preset time to terminate the loading unit Sequence obtains the Data Identification of predetermined amount by criticizing from the database;
    Data query unit, for according to the mark selection instruction received, being selected in the target data mark got It selects, and inquires about the corresponding data of Data Identification with choosing;
    The loading unit is additionally operable to, by it is described according to preset time order by the number that predetermined amount is obtained batch from the database During according to mark, the data corresponding to the Data Identification of the predetermined amount are inquired about in the database, and by the predetermined amount Data corresponding to Data Identification are loaded onto the second storage section;
    Extraction unit, wherein, the data query unit is additionally operable to each data in the target data mark got Mark, inquiry and each target data identify corresponding data in the described second storage section;
    The data that the loading unit is additionally operable to inquire be loaded onto in for use list and, corresponding number will not inquired According to Data Identification store to the presets list;
    The extraction unit for each Data Identification in described the presets list, from the database extraction with it is described The corresponding data of each Data Identification in the presets list, and the data extracted are loaded onto in for use list; And
    The data query unit is inquired about from for use list and chosen with described when receiving the mark selection instruction The corresponding data of Data Identification.
  5. 5. data query system according to claim 4, which is characterized in that the loading unit includes:
    Time acquisition unit, for obtain farthest write time in the database in the write time of each Data Identification and It is most recently written the time;
    Mark acquiring unit, for right from the Data Identification being most recently written corresponding to the time to the farthest write time institute The Data Identification answered, by batch Data Identification of acquisition predetermined amount.
  6. 6. data query system according to claim 4 or 5, which is characterized in that further include:
    Image store, in the loading unit according to preset time order by the data for criticizing the acquisition predetermined amount from database During mark, judge in the data corresponding to the Data Identification of the predetermined amount with the presence or absence of picture, if in the presence of obtaining the figure The picture according to the attribute information is stored to default file, and protected in the corresponding data by the attribute information of piece Stay the attribute information;
    Judging unit, for being inquired and the corresponding data of the Data Identification chosen in the data query unit Afterwards, judgement and the no attribute information there are picture in the corresponding data of Data Identification chosen, if in the presence of according to institute It states attribute information and picture is obtained from the default file, and be added to and the corresponding data of the Data Identification chosen In.
CN201310463740.4A 2013-10-08 2013-10-08 Data query method and data query system Expired - Fee Related CN104516920B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201310463740.4A CN104516920B (en) 2013-10-08 2013-10-08 Data query method and data query system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201310463740.4A CN104516920B (en) 2013-10-08 2013-10-08 Data query method and data query system

Publications (2)

Publication Number Publication Date
CN104516920A CN104516920A (en) 2015-04-15
CN104516920B true CN104516920B (en) 2018-06-05

Family

ID=52792229

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201310463740.4A Expired - Fee Related CN104516920B (en) 2013-10-08 2013-10-08 Data query method and data query system

Country Status (1)

Country Link
CN (1) CN104516920B (en)

Families Citing this family (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106202084A (en) * 2015-04-30 2016-12-07 阿里巴巴集团控股有限公司 Date storage method and data storage device
CN105653652B (en) * 2015-12-28 2019-07-05 上海瀚银信息技术有限公司 A kind of method of data synchronization and system
CN106599235A (en) * 2016-12-20 2017-04-26 四川长虹电器股份有限公司 News acquisition method for Internet-of-Vehicles system
CN106951432A (en) * 2017-01-23 2017-07-14 北京建筑大学 BIM data light weight method and device
CN109241084B (en) * 2018-09-17 2024-05-07 平安科技(深圳)有限公司 Data query method, terminal equipment and medium
CN110781387B (en) * 2019-10-10 2022-11-04 深圳证券交易所 Pushing method of stock market snapshot, stock trading system and storage medium
CN111159521B (en) * 2019-12-12 2024-04-30 中国平安财产保险股份有限公司 Data query method, system, computer device and storage medium
CN112148984B (en) * 2020-09-30 2023-11-10 微梦创科网络科技(中国)有限公司 Method and system for capturing instant interests of user
CN114443581B (en) * 2022-04-11 2022-06-17 苏州浪潮智能科技有限公司 Download control method, device, equipment and storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101751443A (en) * 2008-12-10 2010-06-23 鸿富锦精密工业(深圳)有限公司 Data searching and processing system as well as method
CN102737133A (en) * 2012-06-27 2012-10-17 北京城市网邻信息技术有限公司 Real-time searching method
CN103336671A (en) * 2013-06-17 2013-10-02 北京奇虎科技有限公司 Method and equipment for acquiring data from network

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6681227B1 (en) * 1997-11-19 2004-01-20 Ns Solutions Corporation Database system and a method of data retrieval from the system

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101751443A (en) * 2008-12-10 2010-06-23 鸿富锦精密工业(深圳)有限公司 Data searching and processing system as well as method
CN102737133A (en) * 2012-06-27 2012-10-17 北京城市网邻信息技术有限公司 Real-time searching method
CN103336671A (en) * 2013-06-17 2013-10-02 北京奇虎科技有限公司 Method and equipment for acquiring data from network

Also Published As

Publication number Publication date
CN104516920A (en) 2015-04-15

Similar Documents

Publication Publication Date Title
CN104516920B (en) Data query method and data query system
CN104794177B (en) A kind of date storage method and device
CN106339508B (en) WEB caching method based on paging
RU2666460C2 (en) Support of tagged search results
JP5147947B2 (en) Method and system for generating search collection by query
CN108255958A (en) Data query method, apparatus and storage medium
WO2014165933A1 (en) Methods, systems, apparatus, products, articles and data structures for cross-platform digital content
CN106598972A (en) Information display method and device as well as intelligent terminal
CN105074700A (en) Generating search results containing state links to applications
CA2817554A1 (en) Mobile content management system
WO2008154114A1 (en) Web clip using anchoring
CN102446225A (en) Real-time search method, device and system
CN102737133B (en) A kind of method of real-time search
CN108920600A (en) A kind of metadata of distributed type file system forecasting method based on data correlation
CN107526828B (en) Page information recommendation method and device
CN105373608A (en) Input method based scene-mode content pushing method and system
WO2014108038A1 (en) Frequently-used website generation client terminal, server, system and method
CN106681990A (en) Method for reading caching data under mobile cloud storage environment
CN111124411A (en) Method and system for personalized setting of form based on dynamic page
CN102880707B (en) Webpage body content recognition methods and device
KR20070011547A (en) Item type specific structured search
CN107995098A (en) Information-pushing method and device
CN110020272A (en) Caching method, device and computer storage medium
CN110955855B (en) Information interception method, device and terminal
CN104021203B (en) It is a kind of for accessing the method and device of webpage

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20180605

Termination date: 20191008

CF01 Termination of patent right due to non-payment of annual fee