diff --git a/doc/README.Optimizer.txt b/doc/README.Optimizer.txt index f9b87481ce..2f11f443ca 100644 --- a/doc/README.Optimizer.txt +++ b/doc/README.Optimizer.txt @@ -25,7 +25,7 @@ B) Try to deliver conjuntions made on a UNION inside every single stream. C) Cardinality calculation has been improved for a better estimated value. D) MERGE/SORT operation may now be generated for inner joins using equality - comparsion on expressions. + comparison on expressions. SELECT Count(*) FROM Relations r @@ -33,7 +33,7 @@ D) MERGE/SORT operation may now be generated for inner joins using equality WHERE rc.CategoryID = 3 -E) When a UNIQUE index can be fully matched (equality) used on a relation, use this +E) When a UNIQUE index used on a relation can be fully matched (equality), use this index and forget any possible indexes. F) Indexed order read with an OUTER JOIN. @@ -56,7 +56,7 @@ G) Ignore NULL values in index scan for operators other than IS NULL and Equival Note: This works currently only at single segment indexes. -H) Calculate with more accurate selectivity for compound indexes which are partially +H) Calculate with more accuracy selectivity for compound indexes which are partially matched with conjunctions. Due this we can now use cost-based approach also for partially matched indexes. @@ -76,7 +76,7 @@ J) STARTING WITH can be used inside compound indexes on every segment, but only SELECT * FROM Relations WHERE FirstName = 'Joe' and LastName STARTING WITH 'D' K) Use AND conjunctions also inside OR conjunctions to help with matching on a - compound index. The same calculation for every left and right node of a OR + compound index. The same calculation for every left and right node of an OR conjunction is used as for the AND conjunctions. Example: diff --git a/src/jrd/Optimizer.cpp b/src/jrd/Optimizer.cpp index 67cc4b671c..1a9d9a3441 100644 --- a/src/jrd/Optimizer.cpp +++ b/src/jrd/Optimizer.cpp @@ -1227,10 +1227,10 @@ InversionCandidate* OptimizerRetrieval::generateInversion(RecordSource** rsb) // very safe at the moment, but in our case Array holds a sorted list. // However SortedArray class should be updated to handle join right! matches.join(invCandidate->matches); - size_t pos; tail = optimizer->opt_conjuncts.begin(); for (; tail < opt_end; tail++) { if (!(tail->opt_conjunct_flags & opt_conjunct_used)) { + size_t pos; if (matches.find(tail->opt_conjunct_node, pos)) { tail->opt_conjunct_flags |= opt_conjunct_matched; } diff --git a/src/jrd/isc_file.cpp b/src/jrd/isc_file.cpp index c8bbd592c0..ff2514620a 100644 --- a/src/jrd/isc_file.cpp +++ b/src/jrd/isc_file.cpp @@ -1561,12 +1561,12 @@ bool Mnt::get() const char* start = device; if (n<5) - { return false;} + return false; const char* iflag = strchr(device, ':'); if (iflag) { - node = tstring( start , size_t(iflag-start) ); + node = tstring( start , size_t(iflag - start) ); path = tstring( ++iflag ); } else { diff --git a/src/jrd/opt.cpp b/src/jrd/opt.cpp index 4fcb2cd3f3..846f40bece 100644 --- a/src/jrd/opt.cpp +++ b/src/jrd/opt.cpp @@ -4716,10 +4716,9 @@ static RecordSource* gen_retrieval(thread_db* tdbb, const bool ods11orHigher = (dbb->dbb_ods_version >= ODS_VERSION11); if (ods11orHigher && !relation->rel_file) { // For ODS11 and higher databases we can use new calculations - InversionCandidate* candidate = NULL; OptimizerRetrieval* optimizerRetrieval = FB_NEW(*tdbb->getDefaultPool()) OptimizerRetrieval(*tdbb->getDefaultPool(), opt, stream, outer_flag, inner_flag, sort_ptr); - candidate = optimizerRetrieval->getInversion(&rsb); + InversionCandidate* candidate = optimizerRetrieval->getInversion(&rsb); if (candidate && candidate->inversion) { inversion = candidate->inversion; } @@ -5735,11 +5734,11 @@ static jrd_nod* get_unmapped_node(thread_db* tdbb, jrd_nod* node, SET_TDBB(tdbb); // Check if node is a mapping and if so unmap it, but - // only for root nodes (not contained in an other node). + // only for root nodes (not contained in another node). // This can be expanded by checking complete expression // (Then don't forget to leave aggregate-functions alone // in case of aggregate rse) - // Because this is only to help using a index we keep + // Because this is only to help using an index we keep // it simple. if ((node->nod_type == nod_field) && ((USHORT)(IPTR) node->nod_arg[e_fld_stream] == shellStream))