CN104657447B - The plan tree optimization method and apparatus of oriented database management system - Google Patents

The plan tree optimization method and apparatus of oriented database management system Download PDF

Info

Publication number
CN104657447B
CN104657447B CN201510060935.3A CN201510060935A CN104657447B CN 104657447 B CN104657447 B CN 104657447B CN 201510060935 A CN201510060935 A CN 201510060935A CN 104657447 B CN104657447 B CN 104657447B
Authority
CN
China
Prior art keywords
ttab
node
nodes
subtree
subtrees
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201510060935.3A
Other languages
Chinese (zh)
Other versions
CN104657447A (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.)
Shanghai Dameng Database Co Ltd
Original Assignee
Shanghai Dameng Database 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 Shanghai Dameng Database Co Ltd filed Critical Shanghai Dameng Database Co Ltd
Priority to CN201510060935.3A priority Critical patent/CN104657447B/en
Publication of CN104657447A publication Critical patent/CN104657447A/en
Application granted granted Critical
Publication of CN104657447B publication Critical patent/CN104657447B/en
Active 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/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • 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/21Design, administration or maintenance of databases
    • G06F16/217Database tuning

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)
  • Software Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The embodiment of the invention discloses a kind of plan tree optimization method and apparatus of oriented database management system.Methods described includes:Repetition subtree in being set according to plan, generates the TTAB subtrees using TTAB nodes as root node, and obtain the dependence of TTAB nodes in the TTAB subtrees;Using the repetition subtree in plan tree described in the TTAB node optimizations, and establish TTAB chained lists corresponding with TTAB nodes;According to the dependence of the TTAB nodes, the order of TTAB nodes in the TTAB chained lists is adjusted.The present invention, which solves existing streamline mechanism, to be needed to generate record one by one and identical record data is repeatedly transmitted in subtree, thus cause the technical problem of the very big wasting of resources, realize and effectively simplified plan tree, avoid the technique effect for computing repeatedly processing, improving the performance of data base management system of identical subtree.

Description

The plan tree optimization method and apparatus of oriented database management system
Technical field
The present embodiments relate to database management technology, more particularly to a kind of plan tree of oriented database management system Optimization method.
Background technology
SQL (Structured Query Language, the structuralized query that data base management system inputs according to user Language) plan tree corresponding to sentence generation.Plan tree is one by tree of the various execution operators as node, difference Data base management system may include different operators, but all follow the general principle of database, institute in a SQL statement Comprising view and subquery block be treated as plan tree in a subtree, and these subtrees generally with same operator make For root node.Plan tree largely determines that a data base management system performs the efficiency of sentence, simplifies plan tree The performance of data base management system can be effectively improved.
In the prior art, data base management system all employs when performing and setting corresponding data retrieval operation with plan Same technology, i.e. streamline mechanism.The streamline mechanism, refer to that system calls an execution node every time, just under it Child node obtain a record or a null record and leaf node then directly conduct interviews operation to database base table.
The major defect of prior art is:When the subtree being made up of during plan is set some nodes repeats, due to What these subtrees returned is identical record data, needs to generate record one by one and in subtree using remaining unchanged during streamline mechanism In repeatedly transmit identical record data, this can cause the great wasting of resources.
The content of the invention
In view of this, the embodiment of the present invention provides a kind of the plan tree optimization method and dress of oriented database management system Put, to reduce the generation of identical record data, processing and transmission in a pipeline, effectively improve data base administration system The performance of system.
In a first aspect, the embodiments of the invention provide a kind of plan tree optimization method of oriented database management system, Including:
Repetition subtree in being set according to plan, the TTAB subtrees using TTAB nodes as root node are generated, and described in acquisition The dependence of TTAB nodes in TTAB subtrees;
Using the repetition subtree in plan tree described in the TTAB node optimizations, and establish TTAB corresponding with TTAB nodes Chained list;
According to the dependence of the TTAB nodes, the order of TTAB nodes in the TTAB chained lists is adjusted.
In second aspect, the embodiment of the present invention additionally provides a kind of plan tree optimization dress of oriented database management system Put, including:
TTAB subtree generation modules, for the repetition subtree in being set according to plan, generate using TTAB nodes as root node TTAB subtrees, and obtain the dependence of TTAB nodes in the TTAB subtrees;
TTAB chained lists establish module, for the repetition subtree in being set using plan described in the TTAB node optimizations, and build Found TTAB chained lists corresponding with TTAB nodes;
TTAB node sequence adjusting modules, for the dependence according to the TTAB nodes, adjust the TTAB chained lists The order of middle TTAB nodes.
The embodiment of the present invention generates TTAB using TTAB nodes as root node by the repetition subtree in being set according to plan Tree, and obtain the dependence of TTAB nodes in the TTAB subtrees;Using in plan tree described in the TTAB node optimizations Subtree is repeated, and establishes TTAB chained lists corresponding with TTAB nodes;According to the dependence of the TTAB nodes, described in adjustment The technological means of the order of TTAB nodes in TTAB chained lists, solve existing streamline mechanism need to generate one by one record and Identical record data is repeatedly transmitted in subtree, thus causes the technical problem of the very big wasting of resources, is realized effectively smart Letter plan tree, avoid the technique effect that computes repeatedly processing, improve the performance of data base management system of identical subtree.
Brief description of the drawings
Fig. 1 is a kind of flow of the plan tree optimization method of oriented database management system of first embodiment of the invention Figure;
Fig. 2 is a kind of structural representation of plan tree of first embodiment of the invention;
Fig. 3 is a kind of structural representation of TTAB subtrees of first embodiment of the invention;
Fig. 4 be first embodiment of the invention a kind of description TTAB nodes between dependence schematic diagram;
Fig. 5 is a kind of schematic diagram using TTAB node optimization plan trees of first embodiment of the invention;
Fig. 6 is a kind of flow of the plan tree optimization method of oriented database management system of second embodiment of the invention Figure;
Fig. 7 is that a kind of foundation TTAB chained lists corresponding with TTAB nodes of second embodiment of the invention realize schematic diagram;
Fig. 8 is a kind of flow of the plan tree optimization method of oriented database management system of third embodiment of the invention Figure;
Fig. 9 is a kind of schematic diagram of TTAB chained lists adjustment order of third embodiment of the invention;
Figure 10 is a kind of structure of the plan tree optimization device of oriented database management system of fourth embodiment of the invention Figure.
Embodiment
In order that the object, technical solutions and advantages of the present invention are clearer, below in conjunction with the accompanying drawings to the specific reality of the present invention Example is applied to be described in further detail.It is understood that specific embodiment described herein is used only for explaining the present invention, Rather than limitation of the invention.It also should be noted that for the ease of describing, illustrate only in accompanying drawing related to the present invention Part rather than full content.
First embodiment
Fig. 1 is a kind of flow of the plan tree optimization method of oriented database management system of first embodiment of the invention Figure, the method for the present embodiment can be performed by the plan tree optimization device of oriented database management system, and the device can pass through The mode of hardware and/or software is realized, can be typically integrated in the server for offer plan tree optimization service.The present embodiment Method specifically include following operation:
110th, the repetition subtree in being set according to plan, generates the TTAB subtrees using TTAB (chained list tree) nodes as root node, And obtain the dependence of TTAB nodes in the TTAB subtrees.
In the present embodiment, the repetition subtree during server is set according to plan, is generated using TTAB nodes as root node TTAB subtrees, and obtain the dependence of TTAB nodes in the TTAB subtrees.
In the present embodiment, what the sql like language that plan tree refers to be inputted according to user generated, made by various execution operators For the tree of node.Wherein, figure 2 illustrates a kind of structural representation for planning tree.
Plan the repetition subtree in tree, in particular to be used as at least the two of root node using a node in the plan tree Individual equal tree.So-called equal tree specifically refers to the equal subtree of attribute in all corresponding nodes.As shown in Fig. 2 subtree 21 It is the repetition subtree in the plan tree with subtree 22.
In the present embodiment, after obtaining whole repetition subtrees in plan tree, one is increased for each repetition subtree TTAB nodes are as root node, you can generation TTAB subtrees.In other words, TTAB subtrees be that root node is TTAB nodes one Subtree;It is the subtree that root node is P (a specific node in plan tree) to repeat subtree, is increased in subtree is repeated The root node of TTAB nodes reforms into TTAB subtrees, and in turn, TTAB subtrees remove TTAB root nodes and are just converted back into a repetition Subtree.
In the plan tree shown in Fig. 2,7 repetition subtrees are shared.Wherein, collecting the process of repetition subtree can use respectively Kind algorithm known and data structure are realized, are repeated no more.Different TTAB root nodes are added to this 7 repetition subtrees, are just changed into 7 Individual TTAB subtrees.Figure 3 illustrates above-mentioned 7 repetition subtrees, and its corresponding 7 TTAB subtrees, Tn therein, n ∈ [1, 7] different TTAB root nodes are represented.
In the present embodiment, server generate using TTAB nodes as the TTAB subtrees of root node after, also obtain described in The dependence of each TTAB nodes in TTAB subtrees.
Wherein, if the first repetition subtree is the subtree of the second repetition subtree, then represent the second root section for repeating subtree Point relies on the first root node for repeating subtree.Specifically, as shown in figure 3, the repetition subtree using T2 as root node is using T1 as root The subtree of the repetition subtree of node, then it can determine that T1 depends on T2.Wherein, each TTAB sections in being set figure 4 illustrates plan The dependence of point.
120th, using the repetition subtree in plan tree described in the TTAB node optimizations, and establish corresponding with TTAB nodes TTAB chained lists.
In the present embodiment, server is using the repetition subtree in plan tree described in the TTAB node optimizations, and establishes TTAB chained lists corresponding with TTAB nodes.
Wherein, the repetition subtree in the plan tree is replaced by using the TTAB nodes, it is possible to achieve to the meter Draw the optimization of the repetition subtree in tree.Figure 5 illustrates a kind of the iteron planned in tree is replaced using TTAB nodes Tree.
In the present embodiment, while the repetition subtree in using plan tree described in the TTAB node optimizations, also Establish TTAB chained lists corresponding with TTAB nodes.Each TTAB nodes are stored with the TTAB chained lists.
Wherein, the TTAB chained lists can be while using TTAB node optimization plan trees, synchronous foundation, can also be After TTAB node optimization plan trees, established according to the TTAB nodes that include of plan tree after optimization, to this and without Limitation.
130th, according to the dependence of the TTAB nodes, the order of TTAB nodes in the TTAB chained lists is adjusted.
In the present embodiment, server adjusts TTAB in the TTAB chained lists according to the dependence of the TTAB nodes The order of node.
Wherein, in TTAB chained lists the adjustment of TTAB node sequences in order to ensure whole TTAB that a TTAB node is relied on Node is come before the TTAB nodes.So set the reason for be:It ensure that in the implementation procedure of plan tree, be relied on The calculating of TTAB nodes is by priority treatment, it is ensured that plans the smooth execution of tree.
The embodiment of the present invention generates TTAB using TTAB nodes as root node by the repetition subtree in being set according to plan Tree, and obtain the dependence of TTAB nodes in the TTAB subtrees;Using in plan tree described in the TTAB node optimizations Subtree is repeated, and establishes TTAB chained lists corresponding with TTAB nodes;According to the dependence of the TTAB nodes, described in adjustment The technological means of the order of TTAB nodes in TTAB chained lists, solve existing streamline mechanism need to generate one by one record and Identical record data is repeatedly transmitted in subtree, thus causes the technical problem of the very big wasting of resources, is realized effectively smart Letter plan tree, avoid the technique effect that computes repeatedly processing, improve the performance of data base management system of identical subtree.
On the basis of the various embodiments described above, the repetition subtree in the tree according to plan, generate using TTAB nodes as root The TTAB subtrees of node can include:
Obtain the equal tree of root node identical at least two in the plan tree and be used as repetition subtree;
In the repetition subtree, addition TTAB nodes generate TTAB subtrees as new root node.
On the basis of the various embodiments described above, the dependence for obtaining TTAB nodes in the TTAB subtrees specifically may be used With including:
In the TTAB subtrees, if it is determined that it is iteron in the 2nd TTAB subtrees that subtree is repeated in the first TTAB subtrees The subtree of tree, then the TTAB nodes of mark the 2nd depend on the first TTAB nodes.
Second embodiment
Fig. 6 is a kind of plan tree optimization method flow diagram of oriented database management system of second embodiment of the invention. The present embodiment is optimized based on above-described embodiment, in the present embodiment, preferably to operating with the TTAB nodes Optimize the repetition subtree in the plan tree, and establish TTAB chained lists corresponding with TTAB nodes and optimize.
Accordingly, the method for the present embodiment includes following operation:
610th, the repetition subtree in being set according to plan, generates the TTAB subtrees using TTAB nodes as root node, and obtain institute State the dependence of TTAB nodes in TTAB subtrees.
620th, TTAB chained lists are initialized.
In the present embodiment, server initializes TTAB chained lists first, and the content in the TTAB chained lists is emptied.
630th, the root node of the plan tree is set to present node.
640th, since the present node, the preamble traversal plan tree.
650th, judge whether to get the root node of a repetition subtree:If so, perform 660;Otherwise, 6120 are performed.
660th, using the subtree that repeats of acquisition as operation subtree, and in the plan tree, by the operation subtree Replaced using the TTAB nodes of corresponding TTAB subtrees.
670th, judge whether the TTAB nodes are recorded in the TTAB chained lists, if so, directly performing 690;Otherwise, hold Row 680.
680th, the TTAB nodes are made an addition in the TTAB chained lists, performs 690.
690th, judge whether TTAB subtrees corresponding to the TTAB nodes include next stage and repeat subtree:If so, perform 6100;Otherwise, 6110 are performed.
6100th, the root node that the next stage repeats subtree is obtained in a manner of preamble travels through, returns to 660.
6110th, the root node of the operation subtree is set to present node, returns to 640.
6120th, according to the dependence of the TTAB nodes, the order of TTAB nodes in the TTAB chained lists is adjusted.
In a specific example, plan tree figure 7 illustrates one kind as shown in Fig. 2 establish corresponding with TTAB nodes TTAB chained lists realize schematic diagram, wherein the preamble sequence for planning tree represents in row.
The root node P4 of first repetition subtree is got first, increases a TTAB node T4, is added in TTAB chained lists; This repeats subtree and also has next stage to repeat subtree, obtains next stage iteron root vertex P5, increases a TTAB node T5, will T5 adds TTAB chained lists;
Plan tree is returned, obtains next iteron and root vertex P7, increases a TTAB node T7, T7 is added In TTAB chained lists;
Plan tree is returned, obtains next iteron root vertex P1, increases a TTAB node T1, T1 is added into TTAB Chained list;This repeats subtree and also has next stage to repeat subtree, and preamble travels through the repetition subtree, obtains next iteron root vertex P2 increases a TTAB node T2, and T2 is added into TTAB chained lists;
Continue preamble traversal, obtain next iteron root vertex P4, TTAB node T4 corresponding with P4 is in TTAB In chained list, without adding;
Continue preamble traversal, T6 is added into TTAB chained lists;
Continue preamble traversal, T3 is added into TTAB chained lists;
Continue preamble traversal, discovery T5 is in TTAB chained lists, and without adding, so far, whole P1 repeats subtree and handled Finish;
Return to plan tree, continue to obtain follow-up iteron root vertex, find T3, T1, T7 all in TTAB chained lists, All subtrees that repeat have been changed, and it is T4, T5, T7, T1, T2, T6 and T3 to obtain TTAB chained lists.
The embodiment of the present invention generates TTAB using TTAB nodes as root node by the repetition subtree in being set according to plan Tree, and obtain the dependence of TTAB nodes in the TTAB subtrees;Using in plan tree described in the TTAB node optimizations Subtree is repeated, and establishes TTAB chained lists corresponding with TTAB nodes;According to the dependence of the TTAB nodes, described in adjustment The technological means of the order of TTAB nodes in TTAB chained lists, solve existing streamline mechanism need to generate one by one record and Identical record data is repeatedly transmitted in subtree, thus causes the technical problem of the very big wasting of resources, is realized effectively smart Letter plan tree, avoid the technique effect that computes repeatedly processing, improve the performance of data base management system of identical subtree.
3rd embodiment
Fig. 8 is a kind of flow of the plan tree optimization method of oriented database management system of third embodiment of the invention Figure.The present embodiment is optimized based on above-described embodiment, in the present embodiment, will operation according to the TTAB nodes according to The relation of relying, the order for adjusting TTAB nodes in the TTAB chained lists optimize.
Accordingly, the method for the present embodiment includes following operation:
810th, the repetition subtree in being set according to plan, generates the TTAB subtrees using TTAB nodes as root node, and obtain institute State the dependence of TTAB nodes in TTAB subtrees.
820th, using the repetition subtree in plan tree described in the TTAB node optimizations, and establish corresponding with TTAB nodes TTAB chained lists.
830th, supplementary structure table is constructed, to identify the position adjustment attribute of TTAB nodes in the TTAB chained lists.
In the present embodiment, the position adjustment attribute includes attribute to be adjusted and has adjusted attribute, and the auxiliary knot The position adjustment attribute of each TTAB nodes in structure table is initialized as attribute to be adjusted.
840th, according to the TTAB nodes in the TTAB chained lists order, calculate the present position values of each TTAB nodes.
850th, the TTAB nodes for whether including attribute to be adjusted in the supplementary structure table are judged:If so, perform 860;It is no Then, flow is terminated.
860th, according to the supplementary structure table, the TTAB for sequentially obtaining an attribute to be adjusted in the TTAB chained lists is saved Point, as current operation node.
870th, according to the dependence of the TTAB nodes, obtain the TTAB that current operation node is relied on and rely on set of node Close.
In the present embodiment, the dependence according to the TTAB nodes, obtain what current operation node was relied on TTAB, which relies on node set, can specifically include:
8701st, the TTAB that current operation node is relied on is relied on into node set and is initialized as null set, and will currently grasped Make node as node to be found;
If the TTAB sections that the node to be found is relied on the 8702nd, are obtained according to the dependence of the TTAB nodes Point, perform 8703;Otherwise, directly obtain the TTAB and rely on node set, terminate 870.
8703rd, the TTAB nodes of acquisition are made an addition into the TTAB to rely in node set, and by the TTAB according to Node is relied to return to 8702 as new node to be found.
880th, in the TTAB relies on node set, the TTAB nodes for having adjusted attribute, generation TTAB adjustment models are deleted Enclose set.
890th, judge whether the TTAB adjusting ranges set is null set, if so, performing 8100;Otherwise, 8110 are performed.
8100th, the position adjustment attribute modification of current operation node is returned to 850 to have adjusted attribute.
8110th, in described adjusting range set, the maximum TTAB nodes of present position values are found as maximum position Node.
8120th, judge whether the present position values of current operation node are more than the present position values of maximum position node, if It is to perform 8130;Otherwise, 8140 are performed.
8130th, the position adjustment attribute modification of current operation node is returned to 850 to have adjusted attribute.
8140th, in the TTAB chained lists, by the position adjustment of current operation node to the position of maximum position node it Afterwards, 840 are returned.
Continuous precedent, the initial order of TTAB nodes is T4, T5, T7, T1, T2, T6 and T3 in TTAB chained lists.Shown in Fig. 9 A kind of schematic diagram of TTAB chained lists adjustment order.
Shown in table 1 under each adjustment state of adjustment process, the position adjustment of each TTAB nodes in supplementary structure table The change of attribute (" Y " represents state to be adjusted, and " N " represents to have adjusted state);Table 2 shown under each adjustment state, often The change of the present position values (Location) of individual TTAB nodes;Table 3 shows under each adjustment state, it is necessary to the TTAB adjusted The adjusting range set of node, the dependence node set of TTAB nodes and TTAB nodes.
Table 1
T4 Y Y Y N N N N N N N N
T5 Y Y N N N N N N N N N
T7 Y Y Y Y N N N N N N N
T1 Y Y Y Y Y Y Y Y Y Y N
T2 Y Y Y Y Y Y Y Y N N N
T6 Y Y Y Y Y Y Y N N N N
T3 Y Y Y Y Y Y Y Y Y N N
Table 2
LOCATION B1 B2 B3 B4 B5 B6 B7 B8 B9 B10
T4 1 2 2 2 2 2 2 2 2 2
T5 2 1 1 1 1 1 1 1 1 1
T7 3 3 3 3 3 3 3 3 3 3
T1 4 4 4 4 4 7 7 7 7 7
T2 5 5 5 5 5 4 5 5 5 5
T6 6 6 6 6 6 5 4 4 4 4
T3 7 7 7 7 7 6 6 6 6 6
Table 3
State Need the TTAB adjusted Rely on node set Adjusting range set
B1 T4 T5 T5
B2 T5 N N
B3 T4 T5 N
B4 T7 N N
B5 T1 T5、T4、T2、T6、T3 T2、T6、T3
B6 T2 T6 T6
B7 T6 N N
B8 T2 T5T4T6 N
B9 T3 T5 N
B10 T1 T5T4T2T6T3 N
When starting adjustment, the order of TTAB chained lists is T4, T5, T7, T1, T2, T6 and T3, in supplementary structure table, is owned TTAB nodes be initialized to state to be adjusted:
First adjustment state:First T4 (table 1) for needing to adjust is chosen, obtains adjusting range set T5 (table 3), due to Location(T4)<Location (T5) (table 2), in TTAB chained lists, T4 position is adjusted to after T5.
Second adjustment state:Choosing T5 needs to adjust, and obtains adjusting range collection and is combined into sky, it is determined that in TTAB chained lists, T5 Adjustment is finished, and the position adjustment attribute of T5 in table 1 is arranged to " N ".
3rd adjustment state:Choosing T4 needs to adjust, and obtains adjusting range collection and is combined into sky, it is determined that in TTAB chained lists, T4 Adjustment is finished, and the position adjustment attribute of T4 in table 1 is arranged to " N ".
4th adjustment state:Choosing T7 needs to adjust, and obtains adjusting range collection and is combined into sky, it is determined that in TTAB chained lists, T7 Adjustment is finished, and the position adjustment attribute of T7 in table 1 is arranged to " N ".
5th adjustment state:Choosing T1 needs to adjust, and obtains adjusting range collection and is combined into { T2, T6, T3 }, chooses LOCATION Maximum node is T3, due to Location (T1)<Location (T3), in TTAB chained lists, adjust T1 position to T3 it Afterwards.
6th adjustment state:Choosing T2 needs to adjust, and obtains adjusting range collection and is combined into { T6 }, due to Location (T2)< Location (T6), in TTAB chained lists, T2 position is adjusted to after T6.
7th adjustment state:Choosing T6 needs to adjust, and obtains adjusting range collection and is combined into sky, it is determined that in TTAB chained lists, T6 Adjustment is finished, and the position adjustment attribute of T6 in table 1 is arranged to " N ".
8th adjustment state:Choosing T2 needs to adjust, and obtains adjusting range collection and is combined into sky, it is determined that in TTAB chained lists, T2 Adjustment is finished, and the position adjustment attribute of T2 in table 1 is arranged to " N ".
9th adjustment state:Choosing T3 needs to adjust, and obtains adjusting range collection and is combined into sky, it is determined that in TTAB chained lists, T3 Adjustment is finished, and the position adjustment attribute of T3 in table 1 is arranged to " N ".
Tenth adjustment state:Choosing T1 needs to adjust, and obtains adjusting range collection and is combined into sky, it is determined that in TTAB chained lists, T1 Adjustment is finished, and the position adjustment attribute of T1 in table 1 is arranged to " N ".
So far, TTAB chained lists adjustment is completed.In executive plan tree, it is possible to by all TTAB nodes in TTAB chained lists All calculate in advance in order and generate and cached as interim table.The adjustment of TTAB linked list orders ensure that some TTAB is saved During point generation, its other TTAB node relied on has generated, it is only necessary to which obtaining data from these dependence TTAB nodes is Can.
Continuous precedent, subtree P4, P5 have repeated three times, if according to traditional pipeline processes mechanism, have been required for every time The data of generation P5 nodes are calculated, are transferred to P4 nodes, P4 nodes calculate generation data and are transferred to last layer node again.And use TTAB nodes T5 and T4 corresponding to the method for the present embodiment, P5 and P4, P5 is in plan tree processing initially just as interim Table generation is standby, and P4, P5 subtree are encountered during executive plan tree only needs data in directly acquisition T4, therefore eliminates two The secondary time for calculating generation.
The method of the present embodiment performance enhancing effects when the number that repeatedly subtree repeats during plan is set is more are brighter It is aobvious.In big data quantity analytic type database, SQL statement is usually extremely complex, the executive plan of data base management system generation The number for repeating subtree number in tree and repeating is all more, and systematicness can be substantially improved using the method for the present embodiment Energy.
Fourth embodiment
Figure 10 illustrates a kind of plan tree optimization of oriented database management system of fourth embodiment of the invention dress The structure chart put, as shown in Figure 10, described device includes:
TTAB subtrees generation module 101, for the repetition subtree in being set according to plan, generate using TTAB nodes as root node TTAB subtrees, and obtain the dependence of TTAB nodes in the TTAB subtrees.
TTAB chained lists establish module 102, for the repetition subtree in being set using plan described in the TTAB node optimizations, and Establish TTAB chained lists corresponding with TTAB nodes.
TTAB node sequences adjusting module 103, for the dependence according to the TTAB nodes, adjust the TTAB chains The order of TTAB nodes in table.
The embodiment of the present invention generates TTAB using TTAB nodes as root node by the repetition subtree in being set according to plan Tree, and obtain the dependence of TTAB nodes in the TTAB subtrees;Using in plan tree described in the TTAB node optimizations Subtree is repeated, and establishes TTAB chained lists corresponding with TTAB nodes;According to the dependence of the TTAB nodes, described in adjustment The technological means of the order of TTAB nodes in TTAB chained lists, solve existing streamline mechanism need to generate one by one record and Identical record data is repeatedly transmitted in subtree, thus causes the technical problem of the very big wasting of resources, is realized effectively smart Letter plan tree, avoid the technique effect that computes repeatedly processing, improve the performance of data base management system of identical subtree.
On the basis of the various embodiments described above, the TTAB subtrees generation module can be used for:
Obtain the equal tree of root node identical at least two in the plan tree and be used as repetition subtree;
In the repetition subtree, addition TTAB nodes generate TTAB subtrees as new root node.
On the basis of the various embodiments described above, the TTAB subtrees generation module can be also used for:
In the TTAB subtrees, if it is determined that it is iteron in the 2nd TTAB subtrees that subtree is repeated in the first TTAB subtrees The subtree of tree, then the TTAB nodes of mark the 2nd depend on the first TTAB nodes.
On the basis of the various embodiments described above, the TTAB chained lists, which establish module, can specifically include:
Initialization submodule, for initializing TTAB chained lists;
First present node sets submodule, for the root node of the plan tree to be set into present node;
Preamble travels through submodule, for since the present node, the plan of preamble traversal to be set, if getting one The individual root node for repeating subtree, triggering TTAB nodes replace submodule;
The TTAB nodes replace submodule, for using the subtree that repeats of acquisition as subtree is operated, and described In plan tree, the TTAB nodes of TTAB subtrees corresponding to the operation subtree use are replaced;
TTAB chained lists add submodule, if be not recorded in the TTAB chained lists for the TTAB nodes, by institute State TTAB nodes to make an addition in the TTAB chained lists, triggering next stage subtree traversal submodule;Otherwise, directly trigger described next Level subtree traversal submodule;
The next stage subtree travels through submodule, if including next stage for TTAB subtrees corresponding to the TTAB nodes Subtree is repeated, then the root node that the next stage repeats subtree is obtained in a manner of preamble travels through, triggers the TTAB nodes generation For submodule;Otherwise, trigger the second present node and submodule is set;
Second present node sets submodule, for the root node of the operation subtree to be set into present node, touches Send out preamble traversal submodule.
On the basis of the various embodiments described above, the TTAB node sequences adjusting module can specifically include:
Supplementary structure table builds submodule, for constructing supplementary structure table, to identify TTAB nodes in the TTAB chained lists Position adjustment attribute, wherein, the position adjustment attribute includes attribute to be adjusted and has adjusted attribute, and the supplementary structure The position adjustment attribute of each TTAB nodes in table is initialized as attribute to be adjusted;
Current location calculating sub module, for order, calculating to be each in the TTAB chained lists according to the TTAB nodes The present position values of TTAB nodes;
Current operation node acquisition submodule, for according to the supplementary structure table, sequentially obtaining in the TTAB chained lists An attribute to be adjusted TTAB nodes, as current operation node;
TTAB relies on node set acquisition submodule, for the dependence according to the TTAB nodes, obtains current behaviour Make the TTAB that node is relied on and rely on node set;
The set of TTAB adjusting ranges generates submodule, and used in relying on node set in the TTAB, deletion has adjusted category Property TTAB nodes, generate TTAB adjusting range set;
First Attribute tuning submodule, if null set is combined into for the TTAB adjusting ranges collection, by current operation The position adjustment attribute modification of node triggers the current operation node acquisition submodule to have adjusted attribute;Otherwise, trigger most Big nodes of locations acquisition submodule;
The maximum position node acquisition submodule, in described adjusting range set, finding present position values Maximum TTAB nodes are as maximum position node;
Second Attribute tuning submodule, if the present position values for current operation node are more than maximum position node Present position values, then the position adjustment attribute modification of current operation node is triggered into the current operation section to have adjusted attribute Point acquisition submodule;Otherwise, in the TTAB chained lists, by the position adjustment of current operation node to the position of maximum position node After putting, the current location calculating sub module is triggered.
On the basis of the various embodiments described above, the TTAB, which relies on node set acquisition submodule, can specifically include:
Subelement is initialized, the TTAB for current operation node to be relied on relies on node set and is initialized as empty set Close, and using current operation node as node to be found;
Rely on node and obtain subelement, if for the dependence according to the TTAB nodes, obtain described to be found The TTAB nodes that node is relied on, triggering node addition subelement;Otherwise, directly obtain the TTAB and rely on node set;
The node adds subelement, and node set is relied on for the TTAB nodes of acquisition to be made an addition into the TTAB In, and the TTAB is relied on into node as new node to be found, trigger the dependence node and obtain subelement
The plan tree optimization device for the oriented database management system that the embodiment of the present invention is provided can be used for performing this hair The plan tree optimization method for the oriented database management system that bright any embodiment provides, possesses corresponding functional module, realizes Identical beneficial effect.
Obviously, it will be understood by those skilled in the art that above-mentioned each module of the invention or each step can be by as above Described server and client side implements.Alternatively, the embodiment of the present invention can be with the program that computer installation can perform come real Existing, so as to be stored in storage device by processor to perform, described program can be stored in a kind of calculating In machine readable storage medium storing program for executing, storage medium mentioned above can be read-only storage, disk or CD etc.;Or they are divided Each integrated circuit modules are not fabricated to, or the multiple modules or step in them are fabricated to single integrated circuit module Realize.So, the present invention is not restricted to the combination of any specific hardware and software.
The preferred embodiments of the present invention are the foregoing is only, are not intended to limit the invention, for those skilled in the art For, the present invention can have various changes and change.All any modifications made within spirit and principles of the present invention, it is equal Replace, improve etc., it should be included in the scope of the protection.

Claims (10)

1. a kind of plan tree optimization method of oriented database management system, it is characterised in that including:
Repetition subtree in being set according to plan, the TTAB subtrees using chained list tree TTAB nodes as root node are generated, and described in acquisition The dependence of TTAB nodes in TTAB subtrees;
Using the repetition subtree in plan tree described in the TTAB node optimizations, and establish TTAB chains corresponding with TTAB nodes Table;
According to the dependence of the TTAB nodes, the order of TTAB nodes in the TTAB chained lists is adjusted;
Wherein, using the repetition subtree in plan tree described in the TTAB node optimizations, and establish corresponding with TTAB nodes TTAB chained lists include:
S01, initialization TTAB chained lists;
S02, by it is described plan tree root node be set to present node;
S03, since the present node, preamble traversal it is described plan tree, if getting the root node of a repetition subtree, Perform S04;Otherwise, flow is terminated;
S04, using acquisition it is described repeat subtree as operation subtree, and it is described plan tree in, by it is described operation subtree use The TTAB nodes of corresponding TTAB subtrees replace;
If S05, the TTAB nodes are not recorded in the TTAB chained lists, the TTAB nodes are made an addition into the TTAB In chained list, S06 is performed;Otherwise, S06 is directly performed;
If TTAB subtrees corresponding to S06, the TTAB nodes, which include next stage, repeats subtree, obtained in a manner of preamble travels through Take the next stage to repeat the root node of subtree, return to S04;Otherwise, S07 is performed;
S07, the root node for operating subtree is set to present node, return S03.
2. according to the method for claim 1, it is characterised in that the repetition subtree in being set according to plan, generate and saved with TTAB Point includes for the TTAB subtrees of root node:
Obtain the equal tree of root node identical at least two in the plan tree and be used as repetition subtree;
In the repetition subtree, addition TTAB nodes generate TTAB subtrees as new root node.
3. method according to claim 1 or 2, it is characterised in that obtain the dependence of TTAB nodes in the TTAB subtrees Relation includes:
In the TTAB subtrees, if it is determined that it is that subtree is repeated in the 2nd TTAB subtrees that subtree is repeated in the first TTAB subtrees Subtree, then the TTAB nodes of mark the 2nd depend on the first TTAB nodes.
4. according to the method for claim 1, it is characterised in that according to the dependence of the TTAB nodes, described in adjustment The order of TTAB nodes includes in TTAB chained lists:
S001, construction supplementary structure table, to identify the position adjustment attribute of TTAB nodes in the TTAB chained lists, wherein, it is described Position adjustment attribute includes attribute to be adjusted and has adjusted attribute, and the position of each TTAB nodes in the supplementary structure table is adjusted Whole attribute is initialized as attribute to be adjusted;
S002, according to the TTAB nodes in the TTAB chained lists order, calculate the present position values of each TTAB nodes;
S003, according to the supplementary structure table, sequentially obtain the TTAB nodes of an attribute to be adjusted in the TTAB chained lists, As current operation node;
S004, the dependence according to the TTAB nodes, obtain the TTAB that current operation node is relied on and rely on node set;
S005, in the TTAB relies on node set, delete and adjusted the TTAB nodes of attribute, generate TTAB adjusting range collection Close;
If S006, the TTAB adjusting ranges collection are combined into null set, by the position adjustment attribute modification of current operation node To have adjusted attribute, S003 is returned;Otherwise, S007 is performed;
S007, in described adjusting range set, find the maximum TTAB nodes of present position values as maximum position node;
If the present position values of S008, current operation node are more than the present position values of maximum position node, will currently grasp Make the position adjustment attribute modification of node to have adjusted attribute, return to S003;Otherwise, in the TTAB chained lists, will currently grasp After making position adjustment to the position of maximum position node of node, S002 is returned.
5. according to the method for claim 4, it is characterised in that according to the dependence of the TTAB nodes, obtain current The TTAB that running node is relied on, which relies on node set, to be included:
S0041, TTAB that current operation node is relied on is relied on to node set it is initialized as null set, and by current operation section Point is used as node to be found;
If S0042, the dependence according to the TTAB nodes, the TTAB nodes that the node to be found is relied on are obtained, Perform S0043;Otherwise, directly obtain the TTAB and rely on node set, terminate flow;
S0043, the TTAB nodes of acquisition are made an addition into the TTAB relied in node set, and the TTAB is relied on and saved Point returns to S0042 as new node to be found.
A kind of 6. plan tree optimization device of oriented database management system, it is characterised in that including:
TTAB subtree generation modules, for the repetition subtree in being set according to plan, generate using chained list tree TTAB nodes as root node TTAB subtrees, and obtain the dependence of TTAB nodes in the TTAB subtrees;
TTAB chained lists establish module, for using the repetition subtree in plan tree described in the TTAB node optimizations, and establish with TTAB chained lists corresponding to TTAB nodes;
TTAB node sequence adjusting modules, for the dependence according to the TTAB nodes, adjust in the TTAB chained lists The order of TTAB nodes;
Wherein, the TTAB chained lists are established module and specifically included:
Initialization submodule, for initializing TTAB chained lists;
First present node sets submodule, for the root node of the plan tree to be set into present node;
Preamble travels through submodule, for since the present node, the plan of preamble traversal to be set, if getting a weight The root node of multiple subtree, triggering TTAB nodes replace submodule;
The TTAB nodes replace submodule, for using the subtree that repeats of acquisition as subtree is operated, and in the plan In tree, the TTAB nodes of TTAB subtrees corresponding to the operation subtree use are replaced;
TTAB chained lists add submodule, if be not recorded in the TTAB chained lists for the TTAB nodes, by described in TTAB nodes are made an addition in the TTAB chained lists, triggering next stage subtree traversal submodule;Otherwise, the next stage is directly triggered Subtree travels through submodule;
The next stage subtree travels through submodule, if repeated for TTAB subtrees corresponding to the TTAB nodes including next stage Subtree, then the root node that the next stage repeats subtree is obtained in a manner of preamble travels through, trigger the TTAB nodes and replace son Module;Otherwise, trigger the second present node and submodule is set;
Second present node sets submodule, for the root node of the operation subtree to be set into present node, before triggering Sequence travels through submodule.
7. device according to claim 6, it is characterised in that the TTAB subtrees generation module is used for:
Obtain the equal tree of root node identical at least two in the plan tree and be used as repetition subtree;
In the repetition subtree, addition TTAB nodes generate TTAB subtrees as new root node.
8. the device according to claim 6 or 7, it is characterised in that the TTAB subtrees generation module is additionally operable to:
In the TTAB subtrees, if it is determined that it is that subtree is repeated in the 2nd TTAB subtrees that subtree is repeated in the first TTAB subtrees Subtree, then the TTAB nodes of mark the 2nd depend on the first TTAB nodes.
9. device according to claim 6, it is characterised in that the TTAB node sequences adjusting module specifically includes:
Supplementary structure table builds submodule, for constructing supplementary structure table, to identify the position of TTAB nodes in the TTAB chained lists Adjustment attribute is put, wherein, the position adjustment attribute includes attribute to be adjusted and has adjusted attribute, and in the supplementary structure table The position adjustment attributes of each TTAB nodes be initialized as attribute to be adjusted;
Current location calculating sub module, for according to the TTAB nodes in the TTAB chained lists order, calculate each TTAB section The present position values of point;
Current operation node acquisition submodule, for according to the supplementary structure table, sequentially obtaining one in the TTAB chained lists The TTAB nodes of individual attribute to be adjusted, as current operation node;
TTAB relies on node set acquisition submodule, for the dependence according to the TTAB nodes, obtains current operation section The relied on TTAB of point relies on node set;
The set of TTAB adjusting ranges generates submodule, and used in relying on node set in the TTAB, deletion has adjusted attribute TTAB nodes, generate TTAB adjusting range set;
First Attribute tuning submodule, if being combined into null set for the TTAB adjusting ranges collection, by current operation node Position adjustment attribute modification to have adjusted attribute, trigger the current operation node acquisition submodule;Otherwise, dominant bit is triggered Put node acquisition submodule;
The maximum position node acquisition submodule, in described adjusting range set, finding present position values maximum TTAB nodes as maximum position node;
Second Attribute tuning submodule, if the present position values for current operation node are more than the current of maximum position node Positional value, then the position adjustment attribute modification of current operation node is triggered the current operation node and obtained to have adjusted attribute Take submodule;Otherwise, in the TTAB chained lists, by the position adjustment of current operation node to the position of maximum position node it Afterwards, the current location calculating sub module is triggered.
10. device according to claim 9, it is characterised in that it is specific that the TTAB relies on node set acquisition submodule Including:
Subelement is initialized, the TTAB for current operation node to be relied on relies on node set and is initialized as null set, and Using current operation node as node to be found;
Rely on node and obtain subelement, if for the dependence according to the TTAB nodes, obtain the node to be found The TTAB nodes relied on, triggering node addition subelement;Otherwise, directly obtain the TTAB and rely on node set;
The node adds subelement, is relied on for the TTAB nodes of acquisition to be made an addition into the TTAB in node set, And the TTAB is relied on into node as new node to be found, trigger the dependence node and obtain subelement.
CN201510060935.3A 2015-02-05 2015-02-05 The plan tree optimization method and apparatus of oriented database management system Active CN104657447B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510060935.3A CN104657447B (en) 2015-02-05 2015-02-05 The plan tree optimization method and apparatus of oriented database management system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510060935.3A CN104657447B (en) 2015-02-05 2015-02-05 The plan tree optimization method and apparatus of oriented database management system

Publications (2)

Publication Number Publication Date
CN104657447A CN104657447A (en) 2015-05-27
CN104657447B true CN104657447B (en) 2018-04-03

Family

ID=53248575

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510060935.3A Active CN104657447B (en) 2015-02-05 2015-02-05 The plan tree optimization method and apparatus of oriented database management system

Country Status (1)

Country Link
CN (1) CN104657447B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR102267919B1 (en) 2018-06-28 2021-06-23 주식회사 고영테크놀러지 Method and electronic apparatus for determining cause of mounting failure for component mounted on board
US11428644B2 (en) * 2018-11-27 2022-08-30 Koh Young Technology Inc. Method and electronic apparatus for displaying inspection result of board
US20200356885A1 (en) * 2019-05-10 2020-11-12 International Business Machines Corporation Service management in a dbms
CN112966294B (en) * 2021-01-15 2022-09-09 长沙理工大学 Single-wheel interactive linked list ORAM access method

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1492361A (en) * 2002-10-25 2004-04-28 联想(北京)有限公司 Processing method for embedded data bank searching
CN101751399A (en) * 2008-12-12 2010-06-23 中国移动通信集团河北有限公司 Decision tree optimization method and optimization system
CN101866358A (en) * 2010-06-12 2010-10-20 中国科学院计算技术研究所 Multidimensional interval querying method and system thereof
CN102609493A (en) * 2012-01-20 2012-07-25 东华大学 Connection sequence inquiry optimizing method based on column-storage model
CN103761080A (en) * 2013-12-25 2014-04-30 中国农业大学 Structured query language (SQL) based MapReduce operation generating method and system

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7873627B2 (en) * 2006-01-18 2011-01-18 Microsoft Corporation Relational database scalar subquery optimization
US8296316B2 (en) * 2007-10-17 2012-10-23 Oracle International Corporation Dynamically sharing a subtree of operators in a data stream management system operating on existing queries
US10983998B2 (en) * 2008-06-25 2021-04-20 Microsoft Technology Licensing, Llc Query execution plans by compilation-time execution

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1492361A (en) * 2002-10-25 2004-04-28 联想(北京)有限公司 Processing method for embedded data bank searching
CN101751399A (en) * 2008-12-12 2010-06-23 中国移动通信集团河北有限公司 Decision tree optimization method and optimization system
CN101866358A (en) * 2010-06-12 2010-10-20 中国科学院计算技术研究所 Multidimensional interval querying method and system thereof
CN102609493A (en) * 2012-01-20 2012-07-25 东华大学 Connection sequence inquiry optimizing method based on column-storage model
CN103761080A (en) * 2013-12-25 2014-04-30 中国农业大学 Structured query language (SQL) based MapReduce operation generating method and system

Also Published As

Publication number Publication date
CN104657447A (en) 2015-05-27

Similar Documents

Publication Publication Date Title
US10606834B2 (en) Methods and apparatus of shared expression evaluation across RDBMS and storage layer
CN105549982B (en) A kind of development of automation platform based on model configuration
CN104657447B (en) The plan tree optimization method and apparatus of oriented database management system
US8352459B2 (en) SQL queries for simple network management protocol management information base tables
US9172614B2 (en) Network capacity management system and method
CN110309196A (en) Block chain data storage and query method, apparatus, equipment and storage medium
US10956417B2 (en) Dynamic operation scheduling for distributed data processing
CN104885078A (en) Method for two-stage query optimization in massively parallel processing database clusters
CN109118353B (en) Data processing method and device of wind control model
CN111324577B (en) Yml file reading and writing method and device
CN103745319B (en) A kind of data provenance traceability system based on multi-state scientific workflow and method
WO2017091925A1 (en) Data query method and apparatus, and database system
CN102929996A (en) XPath query optimization method and system
CN104915717A (en) Data processing method, knowledge base reasoning method and related device
CN104298598B (en) The adjustment method of RDFS bodies under distributed environment
CN108369591A (en) System and method for caching and parameterizing ir
US20100005203A1 (en) Method of Merging and Incremantal Construction of Minimal Finite State Machines
CN114741085A (en) Data processing method, device, equipment and storage medium
CN108073641A (en) The method and apparatus for inquiring about tables of data
CN105573726B (en) A kind of rules process method and equipment
US20110082917A1 (en) Quick upload
CN108549688A (en) A kind of optimization method of data manipulation, device, equipment and storage medium
JP2023123636A (en) Hyper parameter tuning method, device and program
CN115130043B (en) Database-based data processing method, device, equipment and storage medium
CN110059107A (en) Plan optimization method, device, system and computer readable storage medium

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