Looking for breakthrough ideas for innovation challenges? Try Patsnap Eureka!

Method for quickly searching tree structure data in database and storage medium

A tree structure, database technology, applied in electrical digital data processing, special data processing applications, instruments, etc., can solve the problem of high cost, achieve broad application prospects and improve search efficiency.

Active Publication Date: 2018-10-19
FUJIAN TIANQUAN EDUCATION TECH LTD
View PDF8 Cites 8 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0004] 1. In terms of space complexity, tree traversal requires data to be stored in memory in a tree structure, which creates additional memory costs for modern applications, because data in modern applications is stored in a table structure in the database
In the case of a large amount of data, this cost can be said to be very high

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • Method for quickly searching tree structure data in database and storage medium
  • Method for quickly searching tree structure data in database and storage medium
  • Method for quickly searching tree structure data in database and storage medium

Examples

Experimental program
Comparison scheme
Effect test

Embodiment 1

[0049] Please refer to Figure 1 to Figure 4 , this embodiment provides a method for quickly searching tree-structured data in a database.

[0050] Firstly, in the database table storing the tree structure data, a field is added to store the node path corresponding to each node in the tree structure.

[0051] Among them, the data of the tree structure is stored in the database instead of the memory in the form of a table structure by default. Here, a table structure corresponding to a tree structure is referred to as a database table for short. The storage structure of the database table is as figure 1 As shown in , it includes the field structure of id (node ​​ID), name (node ​​name), parent (parent node id) and the newly added field path (node ​​path).

[0052] The node path corresponds to all tree nodes that need to be passed from the root node to the current node in the tree structure, including the current node and all its parent nodes. For example figure 1In the tre...

Embodiment 2

[0069] Please refer to figure 1 , this embodiment corresponds to Embodiment 1, and provides a specific application scenario.

[0070] Suppose a company's organizational structure is as follows figure 1 As shown, the database table structure corresponding to the company's organizational structure constructed based on the method of Embodiment 1 is shown in Table 1 below:

[0071] id (node ​​id)

name (node ​​name)

parent (parent node id)

path (node ​​path)

1

Great Education Technology Co., Ltd.

1

-1-

2

Technology Department

1

-1-2-

3

R&D 1 department

2

-1-2-3-

4

R&D 2

2

-1-2-4-

5

Sales

1

-1-5-

[0072] Table I

[0073] Based on the above-mentioned database table structure, a specific search example using the search method of Embodiment 1 is as follows:

[0074] 1. Search for all departments containing the keyword "big" under "Da Education Technology Co., Ltd."

[0075] Ju...

Embodiment 3

[0091] This embodiment corresponds to the first embodiment above, and provides a computer-readable storage medium on which a computer program is stored. When the program is called by the processor, it can realize the fast search tree structure in the database described in the above embodiment. All steps involved in the method of the data. For the specific steps, please refer to the description of Embodiment 1 for details, and will not be repeated here.

[0092] In summary, the method and storage medium for quickly searching tree-structured data in a database provided by the present invention can not only realize fast searching and obtain accurate results, but also greatly reduce the complexity of operations; and only operate based on database tables without additional The memory overhead significantly reduces the space complexity; further, it only needs to add a new field in the database table to realize the support, which is easy to operate and highly practical. The present ...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

PUM

No PUM Login to View More

Abstract

The invention provides a method for quickly searching tree structure data in a database and a storage medium. The method comprises the steps: a node path corresponding to the tree structure of each node is stored to a database table; a request to search all nodes in the tree structure including a node field under a node is received; a node containing the node field is obtained from the database table by searching, and a corresponding node path of the node contains the node. The invention can not only realize quick search for accurate results, but also greatly reduce operation complexity. Operation is only based on the database table without extra memory overhead, which significantly reduces the space complexity. Furthermore, support can be realized only by adding one field in the databasetable, and the operation is simple and practical. The invention is particularly suitable for fast and accurate searching of a large amount of tree structure data, and therefore has a wide applicationprospect and further improves the practicability.

Description

technical field [0001] The invention relates to the field of data retrieval, in particular to a method and a storage medium for quickly searching tree-structured data in a database. Background technique [0002] In the application interaction of the tree structure, the function of fuzzy matching on the tree structure is ubiquitous. For example, the company's departmental organizational structure is tree-shaped from top to bottom. The larger the company, the more levels of structure, so users are allowed to enter keywords to perform fuzzy searches in the tree structure. [0003] Traditional fuzzy search technology is based on tree traversal algorithm, such as breadth-first or depth-first algorithm, but its application has the following shortcomings: [0004] 1. In terms of space complexity, tree traversal requires data to be stored in memory in a tree structure, which creates additional memory costs for modern applications, because data in modern applications is stored in a ...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

Application Information

Patent Timeline
no application Login to View More
Patent Type & Authority Applications(China)
IPC IPC(8): G06F17/30
Inventor 刘德建陈铭陈红和郭玉湖
Owner FUJIAN TIANQUAN EDUCATION TECH LTD
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Patsnap Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Patsnap Eureka Blog
Learn More
PatSnap group products