TW202004526A - Index creating method and apparatus based on NoSQL database of mobile terminal - Google Patents

Index creating method and apparatus based on NoSQL database of mobile terminal Download PDF

Info

Publication number
TW202004526A
TW202004526A TW108106323A TW108106323A TW202004526A TW 202004526 A TW202004526 A TW 202004526A TW 108106323 A TW108106323 A TW 108106323A TW 108106323 A TW108106323 A TW 108106323A TW 202004526 A TW202004526 A TW 202004526A
Authority
TW
Taiwan
Prior art keywords
index
storage structure
nosql database
nosql
index information
Prior art date
Application number
TW108106323A
Other languages
Chinese (zh)
Other versions
TWI706260B (en
Inventor
譚謙
Original Assignee
香港商阿里巴巴集團服務有限公司
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 香港商阿里巴巴集團服務有限公司 filed Critical 香港商阿里巴巴集團服務有限公司
Publication of TW202004526A publication Critical patent/TW202004526A/en
Application granted granted Critical
Publication of TWI706260B publication Critical patent/TWI706260B/en

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

Landscapes

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

Abstract

Disclosed are an index creating method and apparatus based on a NoSQL database of a mobile terminal, a data querying method and apparatus based on a NoSQL database of a mobile terminal, and a computer device and a computer-readable storage medium, which relate to the technical field of data query. The creating method comprises: setting index information according to the attribute of pre-stored data in a NoSQL database (101); according to the type of the pre-stored data with the corresponding attribute, determining to store the index information corresponding to the corresponding attribute in a numeric-type index storage structure or a character-type index storage structure (102); and storing the address of the NoSQL database, the address of the numeric-type index storage structure, and the address of the character-type index storage structure in a NoSQL connection pool (103). According to the method, creating an index according to the attribute of data to be pre-stored in a NoSQL database is establishing an index outside the NoSQL database to query a relationship, and thus, a very complicated design is not needed at an application side, and the index is not correlated with the specific implementation of NoSQL, and has strong portability.

Description

基於行動端NoSQL資料庫的索引建立方法及裝置Method and device for establishing index based on mobile terminal NoSQL database

本發明涉及資料查詢技術領域,特別涉及一種基於行動端NoSQL資料庫的索引建立方法及裝置、資料查詢方法及裝置、電腦設備、電腦可讀儲存媒體。The invention relates to the technical field of data query, in particular to an index creation method and device based on a mobile NoSQL database, a data query method and device, computer equipment, and computer-readable storage media.

行動端的主流資料庫是關係型資料庫Sqlite,而相對於行動端較少的資料量以及較快的查詢儲存時間的需求來講,更為簡單、快速的NoSQL資料庫(Not Only SQL,意即“不僅僅是SQL”。在現代的計算系統上,NoSQL主要用於伺服端海量資料的儲存)是一種更好的替代。但是NoSQL資料庫是基於鍵值儲存,只能用於極為簡單的鍵值查詢。為了實現NoSQL的關係查詢,可以在應用端進行非常複雜的設計,但是這樣不利於NoSQL資料庫的更好的推廣,還可以在NoSQL資料庫內部建立索引機制,但是這樣建立的索引均是與該NoSQL的具體實現強相關,無可移植性。The mainstream database on the mobile side is the relational database Sqlite. Compared with the requirement of less data volume and faster query storage time on the mobile side, the simpler and faster NoSQL database (Not Only SQL, which means "Not just SQL." In modern computing systems, NoSQL is mainly used for the storage of massive data on the server side) is a better alternative. However, the NoSQL database is based on key-value storage and can only be used for extremely simple key-value queries. In order to realize the NoSQL relational query, a very complicated design can be performed on the application side, but this is not conducive to a better promotion of the NoSQL database, and an index mechanism can also be established within the NoSQL database, but the indexes created in this way are all related to the The specific implementation of NoSQL is strongly related and non-portable.

有鑑於此,本發明提供了一種基於行動端NoSQL資料庫的索引建立方法及裝置、資料查詢方法及裝置、電腦設備、電腦可讀儲存媒體,通過在NoSQL資料庫外部建立索引來對NoSQL資料庫進行關係查詢,這樣無需在應用端進行非常複雜的設計,與NoSQL的具體實現不相關,有利於NoSQL資料庫的更好的推廣,具有可移植性。依據上述索引建立方法建立的索引來從NoSQL資料庫中查詢資料,可以達到快速查詢的目的。 為實現上述目的,本發明提供技術方案如下: 根據本發明的第一態樣,提出了基於行動端NoSQL資料庫的索引建立方法,包括: 根據NoSQL資料庫中預存資料的屬性設置索引資訊; 根據相應屬性的預存資料的類型,確定將與相應屬性相對應的索引資訊存入數值型索引儲存結構或字元型索引儲存結構中; 將NoSQL資料庫的位址、數值型索引儲存結構的位址和字元型索引儲存結構的位址儲存在NoSql連接池中。 根據本發明的第二態樣,提出了基於行動端NoSQL資料庫的索引建立裝置,包括: 索引資訊設置模組,用於根據NoSQL資料庫中預存資料的屬性設置索引資訊; 儲存模組,用於根據相應屬性的預存資料的類型,確定將與相應屬性相對應的索引資訊存入數值型索引儲存結構或字元型索引儲存結構中; NoSql連接池,用於儲存NoSQL資料庫的位址、數值型索引儲存結構的位址和字元型索引儲存結構的位址。 根據本發明的第三態樣,提出了基於行動端NoSQL資料庫的資料查詢方法,包括: 接收查詢條件; 根據所述查詢條件從數值型索引儲存結構及/或字元型索引儲存結構中查找到相應的索引資訊; 根據所述索引資訊從NoSql連接池中獲取NoSQL資料庫的位址; 根據所述NoSQL資料庫的位址,從相應的NoSQL資料庫查找相應的資料。 根據本發明的第四態樣,提出了基於行動端NoSQL資料庫的資料查詢裝置,包括: 接收模組,用於接收查詢條件; 索引資訊查找模組,用於根據所述查詢條件從數值型索引儲存結構及/或字元型索引儲存結構中查找到相應的索引資訊; 位址獲取模組,用於根據所述索引資訊從NoSql連接池中獲取NoSQL資料庫的位址; 資料查找模組,用於根據所述NoSQL資料庫的位址,從相應的NoSQL資料庫查找相應的資料。 根據本發明的第五態樣,提出了一種電腦設備,包括記憶體、處理器及儲存在記憶體上並可在處理器上運行的電腦程式,所述處理器執行所述電腦程式時實現上述所述基於行動端NoSQL資料庫的索引建立方法。 根據本發明的第六態樣,提出了一種電腦可讀儲存媒體,所述電腦可讀儲存媒體儲存有執行上述所述基於行動端NoSQL資料庫的索引建立方法的電腦程式。 根據本發明的第七態樣,提出了一種電腦設備,包括記憶體、處理器及儲存在記憶體上並可在處理器上運行的電腦程式,所述處理器執行所述電腦程式時實現上述所述基於行動端NoSQL資料庫的資料查詢方法。 根據本發明的第八態樣,提出了一種電腦可讀儲存媒體,所述電腦可讀儲存媒體儲存有執行上述所述基於行動端NoSQL資料庫的資料查詢方法的電腦程式。 由以上技術方案可見,本發明通過NoSQL資料庫中要預存資料的屬性進行索引建立,是在NoSQL資料庫外部建立索引來對NoSQL資料庫進行關係查詢,這樣無需在應用端進行非常複雜的設計,與NoSQL的具體實現不相關,有利於NoSQL資料庫的更好的推廣,具有可移植性。依據上述索引建立方法建立的索引來從NoSQL資料庫中查詢資料,可以達到快速查詢的目的。In view of this, the present invention provides a mobile terminal NoSQL database-based index creation method and device, data query method and device, computer equipment, and computer-readable storage media. The NoSQL database is indexed by creating an index outside the NoSQL database To conduct relational query, so there is no need for very complicated design on the application side, which is not related to the specific implementation of NoSQL, which is conducive to the better promotion of NoSQL database and has portability. According to the index created by the above index creation method to query data from the NoSQL database, the purpose of quick query can be achieved. To achieve the above objectives, the present invention provides technical solutions as follows: According to the first aspect of the present invention, an index building method based on the mobile NoSQL database is proposed, including: Set index information according to the attributes of pre-stored data in NoSQL database; According to the type of the pre-stored data of the corresponding attribute, determine to store the index information corresponding to the corresponding attribute in the numerical index storage structure or the character index storage structure; Store the address of the NoSQL database, the address of the numeric index storage structure, and the address of the character index storage structure in the NoSql connection pool. According to the second aspect of the present invention, an index building device based on a mobile NoSQL database is proposed, including: Index information setting module, used to set index information according to the attributes of pre-stored data in NoSQL database; The storage module is used to determine the index information corresponding to the corresponding attribute to be stored in the numeric index storage structure or the character index storage structure according to the type of the pre-stored data of the corresponding attribute; The NoSql connection pool is used to store the address of the NoSQL database, the address of the numeric index storage structure, and the address of the character index storage structure. According to the third aspect of the present invention, a data query method based on the mobile NoSQL database is proposed, including: Receive query conditions; Find the corresponding index information from the numerical index storage structure and/or the character index storage structure according to the query conditions; Obtain the address of the NoSQL database from the NoSql connection pool according to the index information; According to the address of the NoSQL database, search the corresponding data from the corresponding NoSQL database. According to the fourth aspect of the present invention, a data query device based on the mobile NoSQL database is proposed, including: Receive module, used to receive query conditions; The index information search module is used to find corresponding index information from the numeric index storage structure and/or the character index storage structure according to the query conditions; The address obtaining module is used to obtain the address of the NoSQL database from the NoSql connection pool according to the index information; The data search module is used for searching corresponding data from the corresponding NoSQL database according to the address of the NoSQL database. According to a fifth aspect of the present invention, a computer device is proposed, which includes a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the computer program, the foregoing The index creation method based on the mobile NoSQL database. According to a sixth aspect of the present invention, a computer-readable storage medium is provided, and the computer-readable storage medium stores a computer program that executes the index creation method based on the mobile NoSQL database. According to the seventh aspect of the present invention, a computer device is proposed, which includes a memory, a processor, and a computer program stored on the memory and executable on the processor. The processor implements the computer program to implement the above The data query method based on the mobile NoSQL database. According to an eighth aspect of the present invention, a computer-readable storage medium is provided, the computer-readable storage medium storing a computer program that executes the data query method based on the mobile NoSQL database. It can be seen from the above technical solutions that the present invention establishes the index through the attributes of the data to be pre-stored in the NoSQL database. The index is established outside the NoSQL database to query the NoSQL database, so that there is no need for a very complicated design on the application side. It is not related to the specific implementation of NoSQL, which is conducive to the better promotion of NoSQL database and has portability. According to the index created by the above index creation method to query data from the NoSQL database, the purpose of quick query can be achieved.

下面將結合本發明實施例中的附圖,對本發明實施例中的技術方案進行清楚、完整地描述,顯然,所描述的實施例僅是本發明一部分實施例,而不是全部的實施例。基於本發明中的實施例,本領域普通技術人員在沒有做出進步性勞動前提下所獲得的所有其他實施例,都屬於本發明保護的範圍。 下面參考本發明的若干代表性實施方式,詳細闡釋本發明的原理和精神。 雖然本發明提供了如下述實施例或附圖所示的方法操作步驟或裝置結構,但基於常規或者無需進步性的勞動在所述方法或裝置中可以包括更多或者更少的操作步驟或模組單元。在邏輯性上不存在必要因果關係的步驟或結構中,這些步驟的執行順序或裝置的模組結構不限於本發明實施例或附圖所示的執行順序或模組結構。所述的方法或模組結構的在實際中的裝置或終端產品應用時,可以按照實施例或者附圖所示的方法或模組結構進行順序執行或者平行執行。 下面介紹本發明的具體技術方案。 傳統的行動端NoSQL資料庫,如realm、objectbox的索引建立和關係查詢均是基於自己的資料庫特定實現,不具備通用性。基於此,在本發明提供了一種基於行動端NoSQL資料庫的索引建立方法,如圖1所示,該方法包括: 步驟101:根據NoSQL資料庫中預存資料的屬性設置索引資訊; 步驟102:根據相應屬性的預存資料的類型,確定將與相應屬性相對應的索引資訊存入數值型索引儲存結構或字元型索引儲存結構中; 步驟103:將NoSQL資料庫的位址、數值型索引儲存結構的位址和字元型索引儲存結構的位址儲存在NoSql連接池中。 在本發明的一種實施方式中,本發明通過注解 (Annotation)來設置索引資訊,這樣做的目的是方便應用層設置索引資訊,對NoSQL資料庫中的原有邏輯無侵入。 在本發明的一種實施方式中,針對數值型索引排序與字元型索引排序的規則不同(後者是字典序),本發明建立了雙索引儲存結構:數值型索引儲存結構和字元型索引儲存結構。在為NoSQL資料庫建立索引時,需要分析其中的預存資料屬於數值型還是字元型。比如,當預存資料為人的資訊時,其資料屬性可以是年齡、姓名、身高、體重等等。針對資料屬性是年齡、身高、體重等,其資料類型屬於數值型,針對資料屬性是姓名時,其資料類型屬於字元型。數值型索引儲存結構和字元型索引儲存結構需要分開儲存。 在本發明的一種實施方式中,現有的NoSQL資料庫中一般存在字元型索引排序,不存在數值型排序,因此,本發明會將與相應屬性相對應的索引資訊進行排序處理(此處所指的是數值型排序),獲得排序處理後的索引資訊,然後步驟102具體按照如下執行:將排序處理後的索引資訊存入數值型索引儲存結構或字元型索引儲存結構中。其中對數值型索引進行排序處理的目的是防止類似“10”小於“2”的情況發生,也就是說不添加數值型排序,會根據字元型排序處理,此時會出現“10”小於“2”的情況。由於索引採用有序結構,使得OrderBy這樣的複雜排序時間複雜度達到O(N)。整個索引建立方法無需侵入底層資料庫實現以及應用層實現,使得本索引建立方法具有強大的可移植性。 在本發明的一種實施方式中,本發明通過NoSql連接池(Connection Pool)來管理多個NoSql實例,從而方便索引的儲存。 基於同一申請構思,本發明還提供了一種基於行動端NoSQL資料庫的索引建立裝置,如下面的實施例所述。由於基於行動端NoSQL資料庫的索引建立裝置解決問題的原理與基於行動端NoSQL資料庫的索引建立方法相似,因此基於行動端NoSQL資料庫的索引建立裝置的實施可以參見基於行動端NoSQL資料庫的索引建立方法的實施,重複之處不再贅述。以下所使用的,術語“單元”或者“模組”可以實現預定功能的軟體及/或硬體的組合。儘管以下實施例所描述的裝置較佳地以軟體來實現,但是硬體,或者軟體和硬體的組合的實現也是可能並被構想的。 圖2是本發明一種基於行動端NoSQL資料庫的索引建立裝置結構方塊圖,如圖2所示,包括: 索引資訊設置模組201,用於根據NoSQL資料庫中預存資料的屬性設置索引資訊; 儲存模組202,用於根據相應屬性的預存資料的類型,確定將與相應屬性相對應的索引資訊存入數值型索引儲存結構或字元型索引儲存結構中; NoSql連接池203,用於儲存NoSQL資料庫的位址、數值型索引儲存結構的位址和字元型索引儲存結構的位址。 在本發明的一種實施方式中,所述儲存模組202具體用於:將所述數值型索引儲存結構和字元型索引儲存結構分開儲存。 在本發明的一種實施方式中,還包括:NoSQL比較器204,用於將與相應屬性相對應的索引資訊進行排序處理,獲得排序處理後的索引資訊; 所述儲存模組202具體用於: 將排序處理後的索引資訊存入數值型索引儲存結構或字元型索引儲存結構中。 基於上述索引建立方法,本發明還提出了基於行動端NoSQL資料庫的資料查詢方法,如圖3所示,該方法包括: 步驟301:接收查詢條件; 步驟302:根據所述查詢條件從數值型索引儲存結構及/或字元型索引儲存結構中查找到相應的索引資訊; 步驟303:根據所述索引資訊從NoSql連接池中獲取NoSQL資料庫的位址; 步驟304:根據所述NoSQL資料庫的位址,從相應的NoSQL資料庫查找相應的資料。 在本發明的一種實施方式中,步驟302具體包括: 確定所述查詢條件的屬性和類型; 根據所述查詢條件的屬性和類型從數值型索引儲存結構及/或字元型索引儲存結構中查找到相應的索引資訊。 本發明在執行資料查詢時,採用Query Clause來提供關係型查詢語句,使用戶代碼邏輯做到無縫移植。 基於同一申請構思,本發明實施例中還提供了一種基於行動端NoSQL資料庫的索引建立裝置,如下面的實施例所述。圖4是本發明一種基於行動端NoSQL資料庫的資料查詢裝置結構方塊圖,如圖4所示,該裝置包括: 接收模組401,用於接收查詢條件; 索引資訊查找模組402,用於根據所述查詢條件從數值型索引儲存結構及/或字元型索引儲存結構中查找到相應的索引資訊; 位址獲取模組403,用於根據所述索引資訊從NoSql連接池中獲取NoSQL資料庫的位址; 資料查找模組404,用於根據所述NoSQL資料庫的位址,從相應的NoSQL資料庫查找相應的資料。 在本發明的一種實施方式中,所述索引資訊查找模組402具體用於: 確定所述查詢條件的屬性和類型; 根據所述查詢條件的屬性和類型從數值型索引儲存結構及/或字元型索引儲存結構中查找到相應的索引資訊。 本發明實施例還提供了一種電腦設備,包括記憶體、處理器及儲存在記憶體上並可在處理器上運行的電腦程式,所述處理器執行所述電腦程式時實現上述所述基於行動端NoSQL資料庫的索引建立方法。 本發明實施例還提供了一種電腦可讀儲存媒體,所述電腦可讀儲存媒體儲存有執行上述所述基於行動端NoSQL資料庫的索引建立方法的電腦程式。 本發明實施例還提供了一種電腦設備,包括記憶體、處理器及儲存在記憶體上並可在處理器上運行的電腦程式,所述處理器執行所述電腦程式時實現上述所述基於行動端NoSQL資料庫的資料查詢方法。 本發明實施例還提供了一種電腦可讀儲存媒體,所述電腦可讀儲存媒體儲存有執行上述所述基於行動端NoSQL資料庫的資料查詢方法的電腦程式。 綜上所述,本發明通過NoSQL資料庫中要預存資料的屬性進行索引建立,是在NoSQL資料庫外部建立索引來對NoSQL資料庫進行關係查詢,這樣無需在應用端進行非常複雜的設計,有利於NoSQL資料庫的更好的推廣,與NoSQL的具體實現不相關,有利於NoSQL資料庫的更好的推廣,具有可移植性。該索引建立方法可以用於任何nosql資料庫。使用本索引建立方法能夠讓行動端自由選擇符合業務要求的nosql資料庫,即使該資料庫無自建索引,也可以實現關係查詢,而無需修改上層業務。依據上述索引建立方法建立的索引來從NoSQL資料庫中查詢資料,可以達到快速查詢的目的。 本領域內的技術人員應明白,本發明的實施例可提供為方法、系統、或電腦程式產品。因此,本發明可採用完全硬體實施例、完全軟體實施例、或結合軟體和硬體態樣的實施例的形式。而且,本發明可採用在一個或多個其中包含有電腦可用程式代碼的電腦可用儲存媒體(包括但不限於磁碟記憶體、CD-ROM、光學記憶體等)上實施的電腦程式產品的形式。 本發明是參照根據本發明實施例的方法、設備(系統)、和電腦程式產品的流程圖及/或方塊圖來描述的。應理解可由電腦程式指令實現流程圖及/或方塊圖中的每一流程及/或方塊、以及流程圖及/或方塊圖中的流程及/或方塊的結合。可提供這些電腦程式指令到通用電腦、專用電腦、嵌入式處理機或其他可編程資料處理設備的處理器以產生一個機器,使得通過電腦或其他可編程資料處理設備的處理器執行的指令產生用於實現在流程圖一個流程或多個流程及/或方塊圖一個方塊或多個方塊中指定的功能的裝置。 這些電腦程式指令也可儲存在能引導電腦或其他可編程資料處理設備以特定方式工作的電腦可讀記憶體中,使得儲存在該電腦可讀記憶體中的指令產生包括指令裝置的製造品,該指令裝置實現在流程圖一個流程或多個流程及/或方塊圖一個方塊或多個方塊中指定的功能。 這些電腦程式指令也可裝載到電腦或其他可編程資料處理設備上,使得在電腦或其他可編程設備上執行一系列操作步驟以產生電腦實現的處理,從而在電腦或其他可編程設備上執行的指令提供用於實現在流程圖一個流程或多個流程及/或方塊圖一個方塊或多個方塊中指定的功能的步驟。 以上所述僅為本發明的優選實施例而已,並不用於限制本發明,對於本領域的技術人員來說,本發明實施例可以有各種更改和變化。凡在本發明的精神和原則之內,所作的任何修改、等同替換、改進等,均應包含在本發明的保護範圍之內。The technical solutions in the embodiments of the present invention will be described clearly and completely in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, but not all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without making progressive labor fall within the protection scope of the present invention. The principle and spirit of the present invention will be explained in detail below with reference to several representative embodiments of the present invention. Although the present invention provides method operation steps or device structures as shown in the following embodiments or drawings, the method or device may include more or less operation steps or modes based on conventional or no progressive labor. Group unit. In steps or structures where there is no necessary causality in logic, the execution order of these steps or the module structure of the device is not limited to the execution order or module structure shown in the embodiments of the present invention or the drawings. When the actual method or module structure is applied to an actual device or terminal product, the method or module structure shown in the embodiments or drawings may be executed sequentially or in parallel. The specific technical solutions of the present invention are described below. Traditional mobile NoSQL databases, such as realm and objectbox index creation and relational queries, are based on their own database-specific implementations and are not universal. Based on this, the present invention provides an index creation method based on the mobile NoSQL database. As shown in FIG. 1, the method includes: Step 101: Set index information according to the attributes of the pre-stored data in the NoSQL database; Step 102: According to the type of the pre-stored data of the corresponding attribute, determine to store the index information corresponding to the corresponding attribute in the numeric index storage structure or the character index storage structure; Step 103: Store the address of the NoSQL database, the address of the numeric index storage structure, and the address of the character index storage structure in the NoSql connection pool. In one embodiment of the present invention, the present invention sets the index information through annotations. The purpose of this is to facilitate the application layer to set the index information without intruding into the original logic in the NoSQL database. In an embodiment of the present invention, for numerical index sorting and character index sorting rules are different (the latter is a lexicographic order), the present invention establishes a dual index storage structure: a numeric index storage structure and a character index storage structure. When creating an index for a NoSQL database, you need to analyze whether the pre-stored data is numeric or character. For example, when the pre-stored data is human information, the data attributes may be age, name, height, weight, etc. For the data attribute is age, height, weight, etc., the data type is numeric, and for the data attribute is the name, the data type is character type. The numeric index storage structure and the character index storage structure need to be stored separately. In one embodiment of the present invention, the existing NoSQL database generally has character index sorting, and there is no numerical sorting. Therefore, the present invention will sort the index information corresponding to the corresponding attributes (referred to here as Is numeric sorting), and the sorted index information is obtained, and then step 102 is specifically executed as follows: storing the sorted index information in a numeric index storage structure or a character index storage structure. The purpose of sorting numerical indexes is to prevent situations like "10" being less than "2". That is to say, if numerical sorting is not added, sorting will be performed according to the character type. At this time, "10" is less than " 2" situation. Because the index uses an ordered structure, the time complexity of complex sorting such as OrderBy reaches O(N). The entire index establishment method does not need to invade the underlying database implementation and application layer implementation, which makes the index establishment method have strong portability. In one embodiment of the present invention, the present invention manages multiple NoSql instances through a NoSql connection pool (Connection Pool), thereby facilitating the storage of indexes. Based on the same application concept, the present invention also provides an index building device based on the mobile NoSQL database, as described in the following embodiments. Since the principle of solving problems with the indexing device based on the mobile NoSQL database is similar to the indexing method based on the mobile NoSQL database, the implementation of the indexing device based on the mobile NoSQL database can be found in the mobile terminal based on the NoSQL database. The implementation of the index establishment method will not be repeated here. As used below, the term “unit” or “module” can be a combination of software and/or hardware that can realize a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, implementation of hardware or a combination of software and hardware is also possible and conceived. FIG. 2 is a block diagram of the structure of an index creation device based on the mobile NoSQL database of the present invention. As shown in FIG. 2, it includes: The index information setting module 201 is used to set the index information according to the attributes of the data stored in the NoSQL database The storage module 202 is used to determine to store the index information corresponding to the corresponding attribute in the numerical index storage structure or the character index storage structure according to the type of the pre-stored data of the corresponding attribute; The NoSql connection pool 203 is used to store the address of the NoSQL database, the address of the numeric index storage structure, and the address of the character index storage structure. In an embodiment of the present invention, the storage module 202 is specifically used to store the numeric index storage structure and the character index storage structure separately. In an embodiment of the present invention, it further includes: a NoSQL comparator 204, which is used to sort the index information corresponding to the corresponding attributes to obtain the sorted index information; The storage module 202 is specifically used for: Store the sorted index information in the numeric index storage structure or the character index storage structure. Based on the above index creation method, the present invention also proposes a data query method based on the mobile NoSQL database, as shown in FIG. 3, the method includes: Step 301: Receive query conditions; Step 302: Find corresponding index information from the numeric index storage structure and/or the character index storage structure according to the query condition; Step 303: Obtain the address of the NoSQL database from the NoSql connection pool according to the index information; Step 304: According to the address of the NoSQL database, search the corresponding data from the corresponding NoSQL database. In an embodiment of the present invention, step 302 specifically includes: Determine the attributes and types of the query conditions; The corresponding index information can be found from the numeric index storage structure and/or the character index storage structure according to the attributes and types of the query conditions. The present invention uses Query Clause to provide relational query statements when performing data query, so that user code logic can be seamlessly transplanted. Based on the same application concept, an embodiment of the present invention also provides an index building device based on the mobile NoSQL database, as described in the following embodiment. FIG. 4 is a block diagram of a data query device based on a mobile NoSQL database of the present invention. As shown in FIG. 4, the device includes: The receiving module 401 is used to receive query conditions; The index information search module 402 is used to find corresponding index information from the numeric index storage structure and/or the character index storage structure according to the query condition; The address obtaining module 403 is used to obtain the address of the NoSQL database from the NoSql connection pool according to the index information; The data search module 404 is used to search for corresponding data from the corresponding NoSQL database according to the address of the NoSQL database. In an embodiment of the present invention, the index information search module 402 is specifically used to: Determine the attributes and types of the query conditions; The corresponding index information can be found from the numeric index storage structure and/or the character index storage structure according to the attributes and types of the query conditions. An embodiment of the present invention also provides a computer device, including a memory, a processor, and a computer program stored on the memory and executable on the processor. The processor executes the computer program to implement the above-mentioned action-based End NoSQL database index creation method. An embodiment of the present invention also provides a computer-readable storage medium that stores a computer program that executes the index creation method based on the mobile NoSQL database. An embodiment of the present invention also provides a computer device, including a memory, a processor, and a computer program stored on the memory and executable on the processor. The processor executes the computer program to implement the above-mentioned action-based NoSQL database data query method. Embodiments of the present invention also provide a computer-readable storage medium that stores a computer program that executes the data query method based on the mobile NoSQL database. In summary, the present invention indexes the attributes of the data to be pre-stored in the NoSQL database, and establishes an index outside the NoSQL database to query the NoSQL database, so that there is no need for a very complicated design on the application side, which is beneficial The better promotion of NoSQL database is not related to the specific implementation of NoSQL, which is conducive to the better promotion of NoSQL database and has portability. The index creation method can be used for any nosql database. Using this index creation method allows the mobile terminal to freely choose the nosql database that meets the business requirements. Even if the database does not have a self-built index, it can also implement relational queries without modifying the upper-level business. According to the index created by the above index creation method to query data from the NoSQL database, the purpose of quick query can be achieved. Those skilled in the art should understand that the embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present invention can take the form of computer program products implemented on one or more computer usable storage media (including but not limited to disk memory, CD-ROM, optical memory, etc.) containing computer usable program code . The present invention is described with reference to flowcharts and/or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each flow and/or block in the flowchart and/or block diagram and a combination of the flow and/or block in the flowchart and/or block diagram can be implemented by computer program instructions. These computer program instructions can be provided to the processors of general-purpose computers, special-purpose computers, embedded processors, or other programmable data processing equipment to generate a machine that enables the generation of instructions executed by the processor of the computer or other programmable data processing equipment A device for realizing the functions specified in one block or multiple blocks in one flow or multiple processes in a flowchart and/or one block in a block diagram. These computer program instructions can also be stored in a computer readable memory that can guide a computer or other programmable data processing equipment to work in a specific manner, so that the instructions stored in the computer readable memory produce a manufactured product including an instruction device, The instruction device realizes the function specified in one block or multiple blocks in one flow or multiple flows in the flowchart and/or one block in the block diagram. These computer program instructions can also be loaded on a computer or other programmable data processing device, so that a series of operating steps can be performed on the computer or other programmable device to generate computer-implemented processing, which can be executed on the computer or other programmable device The instructions provide steps for implementing the functions specified in one block or multiple blocks of the flowchart one flow or multiple flows and/or block diagrams. The above is only the preferred embodiments of the present invention and is not intended to limit the present invention. For those skilled in the art, the embodiments of the present invention may have various modifications and changes. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

101‧‧‧步驟 102‧‧‧步驟 103‧‧‧步驟 201‧‧‧索引資訊設置模組 202‧‧‧儲存模組 203‧‧‧NoSql連接池 204‧‧‧NoSQL比較器 301‧‧‧步驟 302‧‧‧步驟 303‧‧‧步驟 304‧‧‧步驟 401‧‧‧接收模組 402‧‧‧索引資訊查找 403‧‧‧位址獲取模組 404‧‧‧資料查找模組101‧‧‧Step 102‧‧‧Step 103‧‧‧Step 201‧‧‧Index information setting module 202‧‧‧storage module 203‧‧‧NoSql connection pool 204‧‧‧NoSQL Comparator 301‧‧‧Step 302‧‧‧Step 303‧‧‧Step 304‧‧‧Step 401‧‧‧Receiving module 402‧‧‧Index information search 403‧‧‧Address acquisition module 404‧‧‧Data search module

為了更清楚地說明本發明實施例或現有技術中的技術方案,下面將對實施例或現有技術描述中所需要使用的附圖作簡單地介紹,顯而易見地,下面描述中的附圖僅僅是本發明的一些實施例,對於本領域普通技術人員來講,在不付出進步性勞動的前提下,還可以根據這些附圖獲得其他的附圖。 圖1是本發明一種基於行動端NoSQL資料庫的索引建立方法流程圖; 圖2是本發明一種基於行動端NoSQL資料庫的索引建立裝置結構方塊圖; 圖3是本發明一種基於行動端NoSQL資料庫的資料查詢方法流程圖; 圖4是本發明一種基於行動端NoSQL資料庫的資料查詢裝置結構方塊圖。In order to more clearly explain the embodiments of the present invention or the technical solutions in the prior art, the following will briefly introduce the drawings used in the description of the embodiments or the prior art. Obviously, the drawings in the following description are only For some embodiments of the invention, those of ordinary skill in the art can obtain other drawings according to these drawings without paying progressive labor. FIG. 1 is a flowchart of an index creation method based on the mobile NoSQL database of the present invention; 2 is a block diagram of an index creation device based on a mobile NoSQL database according to the present invention; 3 is a flow chart of a method for querying data based on a mobile NoSQL database according to the present invention; 4 is a block diagram of a data query device based on the mobile NoSQL database of the present invention.

Claims (14)

一種基於行動端NoSQL資料庫的索引建立方法,其特徵在於,包括: 根據NoSQL資料庫中預存資料的屬性設置索引資訊; 根據相應屬性的預存資料的類型,確定將與相應屬性相對應的索引資訊資訊存入數值型索引儲存結構或字元型索引儲存結構中; 將NoSQL資料庫的位址、數值型索引儲存結構的位址和字元型索引儲存結構的位址儲存在NoSql連接池中。An index building method based on mobile NoSQL database, which is characterized by: Set index information according to the attributes of pre-stored data in NoSQL database; According to the type of the pre-stored data of the corresponding attribute, determine to store the index information corresponding to the corresponding attribute in the numeric index storage structure or the character index storage structure; Store the address of the NoSQL database, the address of the numeric index storage structure, and the address of the character index storage structure in the NoSql connection pool. 如請求項1所述的基於行動端NoSQL資料庫的索引建立方法,其中,所述數值型索引儲存結構和字元型索引儲存結構分開儲存。The method for creating an index based on a mobile NoSQL database according to claim 1, wherein the numeric index storage structure and the character index storage structure are stored separately. 如請求項1所述的基於行動端NoSQL資料庫的索引建立方法,其中,還包括: 將與相應屬性相對應的索引資訊進行排序處理,獲得排序處理後的索引資訊; 將與相應屬性相對應的索引資訊存入數值型索引儲存結構或字元型索引儲存結構中,包括: 將排序處理後的索引資訊存入數值型索引儲存結構或字元型索引儲存結構中。The index creation method based on the mobile NoSQL database as described in claim 1, which further includes: Sort the index information corresponding to the corresponding attributes to obtain the sorted index information; Store the index information corresponding to the corresponding attributes in the numeric index storage structure or the character index storage structure, including: Store the sorted index information in the numeric index storage structure or the character index storage structure. 一種基於行動端NoSQL資料庫的索引建立裝置,其特徵在於,包括: 索引資訊設置模組,用於根據NoSQL資料庫中預存資料的屬性設置索引資訊; 儲存模組,用於根據相應屬性的預存資料的類型,確定將與相應屬性相對應的索引資訊存入數值型索引儲存結構或字元型索引儲存結構中; NoSql連接池,用於儲存NoSQL資料庫的位址、數值型索引儲存結構的位址和字元型索引儲存結構的位址。An index building device based on mobile NoSQL database, which is characterized by: Index information setting module, used to set index information according to the attributes of pre-stored data in NoSQL database; The storage module is used to determine the index information corresponding to the corresponding attribute to be stored in the numeric index storage structure or the character index storage structure according to the type of the pre-stored data of the corresponding attribute; The NoSql connection pool is used to store the address of the NoSQL database, the address of the numeric index storage structure, and the address of the character index storage structure. 如請求項4所述的基於行動端NoSQL資料庫的索引建立裝置,其中,所述儲存模組具體用於:將所述數值型索引儲存結構和字元型索引儲存結構分開儲存。The index creation device based on the mobile NoSQL database according to claim 4, wherein the storage module is specifically configured to separately store the numeric index storage structure and the character index storage structure. 如請求項4所述的基於行動端NoSQL資料庫的索引建立裝置,其中,還包括:NoSQL比較器,用於將與相應屬性相對應的索引資訊進行排序處理,獲得排序處理後的索引資訊; 所述儲存模組具體用於: 將排序處理後的索引資訊存入數值型索引儲存結構或字元型索引儲存結構中。The index creation device based on the mobile NoSQL database as described in claim 4, further comprising: a NoSQL comparator for sorting the index information corresponding to the corresponding attributes to obtain the sorted index information; The storage module is specifically used for: Store the sorted index information in the numeric index storage structure or the character index storage structure. 一種基於行動端NoSQL資料庫的資料查詢方法,其特徵在於,包括: 接收查詢條件; 根據所述查詢條件從數值型索引儲存結構及/或字元型索引儲存結構中查找到相應的索引資訊; 根據所述索引資訊從NoSql連接池中獲取NoSQL資料庫的位址; 根據所述NoSQL資料庫的位址,從相應的NoSQL資料庫查找相應的資料。A data query method based on the mobile NoSQL database, which includes: Receive query conditions; Find the corresponding index information from the numerical index storage structure and/or the character index storage structure according to the query conditions; Obtain the address of the NoSQL database from the NoSql connection pool according to the index information; According to the address of the NoSQL database, search the corresponding data from the corresponding NoSQL database. 如請求項7所述的基於行動端NoSQL資料庫的資料查詢方法,其中,根據所述查詢條件從數值型索引儲存結構及/或字元型索引儲存結構中查找到相應的索引資訊,包括: 確定所述查詢條件的屬性和類型; 根據所述查詢條件的屬性和類型從數值型索引儲存結構及/或字元型索引儲存結構中查找到相應的索引資訊。The data query method based on the mobile NoSQL database according to claim 7, wherein the corresponding index information is found from the numeric index storage structure and/or the character index storage structure according to the query conditions, including: Determine the attributes and types of the query conditions; The corresponding index information can be found from the numeric index storage structure and/or the character index storage structure according to the attributes and types of the query conditions. 一種基於行動端NoSQL資料庫的資料查詢裝置,其特徵在於,包括: 接收模組,用於接收查詢條件; 索引資訊查找模組,用於根據所述查詢條件從數值型索引儲存結構及/或字元型索引儲存結構中查找到相應的索引資訊; 位址獲取模組,用於根據所述索引資訊從NoSql連接池中獲取NoSQL資料庫的位址; 資料查找模組,用於根據所述NoSQL資料庫的位址,從相應的NoSQL資料庫查找相應的資料。A data query device based on mobile NoSQL database, which is characterized by: Receive module, used to receive query conditions; The index information search module is used to find corresponding index information from the numeric index storage structure and/or the character index storage structure according to the query conditions; The address obtaining module is used to obtain the address of the NoSQL database from the NoSql connection pool according to the index information; The data search module is used for searching corresponding data from the corresponding NoSQL database according to the address of the NoSQL database. 如請求項9所述的基於行動端NoSQL資料庫的資料查詢裝置,其中,所述索引資訊查找模組具體用於: 確定所述查詢條件的屬性和類型; 根據所述查詢條件的屬性和類型從數值型索引儲存結構及/或字元型索引儲存結構中查找到相應的索引資訊。The data query device based on the mobile NoSQL database as described in claim 9, wherein the index information search module is specifically used for: Determine the attributes and types of the query conditions; The corresponding index information can be found from the numeric index storage structure and/or the character index storage structure according to the attributes and types of the query conditions. 一種電腦設備,包括記憶體、處理器及儲存在記憶體上並可在處理器上運行的電腦程式,其特徵在於,所述處理器執行所述電腦程式時實現請求項1至3任一所述方法。A computer device, including a memory, a processor, and a computer program stored on the memory and capable of running on the processor, characterized in that, when the processor executes the computer program, any one of request items 1 to 3 is realized述方法。 The method. 一種電腦可讀儲存媒體,其特徵在於,所述電腦可讀儲存媒體儲存有執行請求項1至3任一所述方法的電腦程式。A computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program that executes any one of the methods of request items 1 to 3. 一種電腦設備,包括記憶體、處理器及儲存在記憶體上並可在處理器上運行的電腦程式,其特徵在於,所述處理器執行所述電腦程式時實現請求項7至8任一所述方法。A computer device, including a memory, a processor, and a computer program stored on the memory and capable of running on the processor, characterized in that when the processor executes the computer program, any one of the items 7 to 8 is realized述方法。 The method. 一種電腦可讀儲存媒體,其特徵在於,所述電腦可讀儲存媒體儲存有執行請求項7至8任一所述方法的電腦程式。A computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program that executes any of the methods described in items 7 to 8.
TW108106323A 2018-05-29 2019-02-25 Index establishment method and device based on mobile terminal NoSQL database TWI706260B (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201810527206.8A CN108776678B (en) 2018-05-29 2018-05-29 Index creation method and device based on mobile terminal NoSQL database
CN201810527206.8 2018-05-29

Publications (2)

Publication Number Publication Date
TW202004526A true TW202004526A (en) 2020-01-16
TWI706260B TWI706260B (en) 2020-10-01

Family

ID=64027930

Family Applications (1)

Application Number Title Priority Date Filing Date
TW108106323A TWI706260B (en) 2018-05-29 2019-02-25 Index establishment method and device based on mobile terminal NoSQL database

Country Status (3)

Country Link
CN (1) CN108776678B (en)
TW (1) TWI706260B (en)
WO (1) WO2019228015A1 (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108776678B (en) * 2018-05-29 2020-07-03 阿里巴巴集团控股有限公司 Index creation method and device based on mobile terminal NoSQL database
CN109637602B (en) * 2018-11-23 2021-06-18 金色熊猫有限公司 Medical data storage and query method, device, storage medium and electronic equipment
CN109656923B (en) * 2018-12-19 2020-11-24 北京字节跳动网络技术有限公司 Data processing method and device, electronic equipment and storage medium
US11762859B2 (en) 2020-09-28 2023-09-19 International Business Machines Corporation Database query with index leap usage
CN112486915B (en) * 2020-12-18 2023-01-20 上海哔哩哔哩科技有限公司 Data storage method and device

Family Cites Families (16)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103177027B (en) * 2011-12-23 2016-02-17 北京新媒传信科技有限公司 Obtain the method and system of dynamic Feed index
CN103514229A (en) * 2012-06-29 2014-01-15 国际商业机器公司 Method and device used for processing database data in distributed database system
WO2014144889A2 (en) * 2013-03-15 2014-09-18 Amazon Technologies, Inc. Scalable analysis platform for semi-structured data
US9390162B2 (en) * 2013-04-25 2016-07-12 International Business Machines Corporation Management of a database system
CN104794123B (en) * 2014-01-20 2018-07-27 阿里巴巴集团控股有限公司 A kind of method and device building NoSQL database indexes for semi-structured data
CN103902702B (en) * 2014-03-31 2017-11-28 北京皮尔布莱尼软件有限公司 A kind of data-storage system and storage method
CN105488050B (en) * 2014-09-17 2019-03-08 阿里巴巴集团控股有限公司 A kind of more indexing means of database, apparatus and system
TWI522827B (en) * 2015-01-09 2016-02-21 Chunghwa Telecom Co Ltd Real-time storage and real-time reading of huge amounts of data for non-related databases
CN104915450B (en) * 2015-07-01 2017-11-28 武汉大学 A kind of big data storage and retrieval method and system based on HBase
CN105447105A (en) * 2015-11-13 2016-03-30 福建农林大学 NoSQL-based single field section index query method for distributed Internet of things data
US10628466B2 (en) * 2016-01-06 2020-04-21 Quest Software Inc. Smart exchange database index
CN106874329A (en) * 2016-07-15 2017-06-20 阿里巴巴集团控股有限公司 The implementation method and device of database table index
CN106372177B (en) * 2016-08-30 2019-09-27 东华大学 Support the correlation inquiry of mixed data type and the enquiry expanding method of fuzzy grouping
CN108090064B (en) * 2016-11-21 2021-10-08 腾讯科技(深圳)有限公司 Data query method and device, data storage server and system
CN106528898A (en) * 2017-01-04 2017-03-22 泰康保险集团股份有限公司 Method and device for converting data of non-relational database into relational database
CN108776678B (en) * 2018-05-29 2020-07-03 阿里巴巴集团控股有限公司 Index creation method and device based on mobile terminal NoSQL database

Also Published As

Publication number Publication date
CN108776678A (en) 2018-11-09
WO2019228015A1 (en) 2019-12-05
CN108776678B (en) 2020-07-03
TWI706260B (en) 2020-10-01

Similar Documents

Publication Publication Date Title
Deng et al. The Data Civilizer System.
TWI706260B (en) Index establishment method and device based on mobile terminal NoSQL database
US10726039B2 (en) Systems and methods for updating database indexes
US10671671B2 (en) Supporting tuples in log-based representations of graph databases
US10789295B2 (en) Pattern-based searching of log-based representations of graph databases
US10565201B2 (en) Query processing management in a database management system
Junghanns et al. Cypher-based graph pattern matching in Gradoop
US9703817B2 (en) Incremental information integration using a declarative framework
Chu et al. KATARA: reliable data cleaning with knowledge bases and crowdsourcing
US11194840B2 (en) Incremental clustering for enterprise knowledge graph
CN105760418B (en) Method and system for performing cross-column search on relational database table
US10901963B2 (en) Database entity analysis
US11720543B2 (en) Enforcing path consistency in graph database path query evaluation
US20180089252A1 (en) Verifying correctness in graph databases
US20180357278A1 (en) Processing aggregate queries in a graph database
US10303726B2 (en) Decoupling filter injection and evaluation by forced pushdown of filter attributes in calculation models
US20160070707A1 (en) Keyword search on databases
US20180357328A1 (en) Functional equivalence of tuples and edges in graph databases
US11188594B2 (en) Wildcard searches using numeric string hash
US20190303478A1 (en) Path query evaluation in graph databases
US10191942B2 (en) Reducing comparisons for token-based entity resolution
US20180113908A1 (en) Transforming and evaluating missing values in graph databases
US11880370B2 (en) Retroreflective join graph generation for relational database queries
US11423027B2 (en) Text search of database with one-pass indexing
US10417216B2 (en) Determining an intersection between keys defining multi-dimensional value ranges