From: Jakub Bogusz Date: Fri, 18 Jul 2008 21:07:24 +0000 (+0000) Subject: - obsolete X-Git-Tag: auto/th/Firebird-2_1_1_17910-1~7 X-Git-Url: http://git.pld-linux.org/?p=packages%2FFirebird.git;a=commitdiff_plain;h=45a4d28ffda3f0b0385ce1d1b68ab238e59a6966;hp=934b60d40d5a896865c3b0d342178149c35686e5 - obsolete Changed files: Firebird-opt-bypass-redundant-sort.dpatch -> 1.2 --- diff --git a/Firebird-opt-bypass-redundant-sort.dpatch b/Firebird-opt-bypass-redundant-sort.dpatch deleted file mode 100644 index 1e9bb56..0000000 --- a/Firebird-opt-bypass-redundant-sort.dpatch +++ /dev/null @@ -1,103 +0,0 @@ -#! /bin/sh /usr/share/dpatch/dpatch-run -## 009_opt-bypass-redundant-sort.dpatch by -## -## All lines beginning with `## DP:' are a description of the patch. -## DP: RP: optimize sort with OUTER JOIN if all the fields in the sort list -## DP: are from one stream, check the stream is the most outer stream, if true -## DP: update rse and ignore the sort - -@DPATCH@ - ---- firebird2-1.5.2.orig/src/jrd/opt.cpp -+++ firebird2-1.5.2/src/jrd/opt.cpp -@@ -1518,7 +1518,89 @@ - set_position(sort, project, NULL); - sort = rse->rse_sorted = NULL; - } -- } -+ } -+ -+ // RP: optimize sort with OUTER JOIN -+ // if all the fields in the sort list are from one stream, check the stream is -+ // the most outer stream, if true update rse and ignore the sort -+ if (sort) { -+ UCHAR sort_stream = 0; -+ bool usableSort = true; -+ sort_ptr = sort->nod_arg; -+ sort_end = sort_ptr + sort->nod_count; -+ for (; sort_ptr < sort_end; sort_ptr++) { -+ if ((*sort_ptr)->nod_type == nod_field) { -+ // Get stream for this field at this position. -+ const UCHAR current_stream = (UCHAR)(IPTR)(*sort_ptr)->nod_arg[e_fld_stream]; -+ // If this is the first position node, save this stream. -+ if (sort_ptr == sort->nod_arg) { -+ sort_stream = current_stream; -+ } -+ else if (current_stream != sort_stream) { -+ // If the current stream is different then the previous stream -+ // then we can't use this sort for an indexed order retrieval. -+ usableSort = false; -+ break; -+ } -+ } -+ else { -+ // This position doesn't use a simple field, thus we can't use -+ // any index for the sort. -+ usableSort = false; -+ break; -+ } -+ } -+ -+ if (usableSort) { -+ RSE new_rse = NULL; -+ JRD_NOD node = (JRD_NOD) rse; -+ while (node) { -+ if (node->nod_type == nod_rse) { -+ new_rse = (RSE) node; -+ if (new_rse->rse_jointype == blr_inner) { -+ if (new_rse->rse_count == 1) { -+ node = new_rse->rse_relation[0]; -+ } -+ else { -+ bool sortStreamFound = false; -+ for (int i = 0; i < new_rse->rse_count; i++) { -+ JRD_NOD subNode = (JRD_NOD) new_rse->rse_relation[i]; -+ if (subNode->nod_type == nod_relation && -+ ((USHORT)(IPTR)subNode->nod_arg[e_rel_stream]) == sort_stream && -+ new_rse != rse) -+ { -+ sortStreamFound = true; -+ break; -+ } -+ -+ } -+ if (sortStreamFound) { -+ new_rse->rse_sorted = sort; -+ sort = rse->rse_sorted = NULL; -+ } -+ node = NULL; -+ } -+ } -+ else if (new_rse->rse_jointype == blr_left) { -+ node = new_rse->rse_relation[0]; -+ } -+ else { -+ node = NULL; -+ } -+ } -+ else { -+ if (node->nod_type == nod_relation && -+ ((USHORT)(IPTR)node->nod_arg[e_rel_stream]) == sort_stream && -+ new_rse && new_rse != rse) -+ { -+ new_rse->rse_sorted = sort; -+ sort = rse->rse_sorted = NULL; -+ } -+ node = NULL; -+ } -+ } -+ } -+ } - } - -