mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-23 04:43:03 +01:00
Style.
This commit is contained in:
parent
8b4bf780e0
commit
e704280a59
@ -2619,13 +2619,14 @@ InversionCandidate* OptimizerRetrieval::matchOnIndexes(
|
||||
invCandidate->dependencies = invCandidate1->dependencies + invCandidate2->dependencies;
|
||||
|
||||
// Add matches conjunctions that exists in both left and right inversion
|
||||
if ((invCandidate1->matches.getCount()) && (invCandidate2->matches.getCount())) {
|
||||
if ((invCandidate1->matches.getCount()) && (invCandidate2->matches.getCount()))
|
||||
{
|
||||
Firebird::SortedArray<jrd_nod*> matches;
|
||||
size_t j;
|
||||
for (j = 0; j < invCandidate1->matches.getCount(); j++) {
|
||||
for (size_t j = 0; j < invCandidate1->matches.getCount(); j++) {
|
||||
matches.add(invCandidate1->matches[j]);
|
||||
}
|
||||
for (j = 0; j < invCandidate2->matches.getCount(); j++) {
|
||||
for (size_t j = 0; j < invCandidate2->matches.getCount(); j++)
|
||||
{
|
||||
if (matches.exist(invCandidate2->matches[j])) {
|
||||
invCandidate->matches.add(invCandidate2->matches[j]);
|
||||
}
|
||||
@ -3252,8 +3253,7 @@ void OptimizerInnerJoin::findBestOrder(int position, InnerJoinStreamInfo* stream
|
||||
// state after each test.
|
||||
Firebird::HalfStaticArray<bool, OPT_STATIC_ITEMS> streamFlags(pool);
|
||||
streamFlags.grow(innerStreams.getCount());
|
||||
size_t i;
|
||||
for (i = 0; i < streamFlags.getCount(); i++) {
|
||||
for (size_t i = 0; i < streamFlags.getCount(); i++) {
|
||||
streamFlags[i] = innerStreams[i]->used;
|
||||
}
|
||||
|
||||
@ -3303,8 +3303,7 @@ void OptimizerInnerJoin::findBestOrder(int position, InnerJoinStreamInfo* stream
|
||||
if (!done && !plan)
|
||||
{
|
||||
// Add these relations to the processing list
|
||||
size_t j = 0;
|
||||
for (j = 0; j < stream->indexedRelationships.getCount(); j++)
|
||||
for (size_t j = 0; j < stream->indexedRelationships.getCount(); j++)
|
||||
{
|
||||
IndexRelationship* relationship = stream->indexedRelationships[j];
|
||||
InnerJoinStreamInfo* relationStreamInfo = getStreamInfo(relationship->stream);
|
||||
@ -3340,7 +3339,7 @@ void OptimizerInnerJoin::findBestOrder(int position, InnerJoinStreamInfo* stream
|
||||
}
|
||||
|
||||
IndexRelationship** nextRelationship = processList->begin();
|
||||
for (j = 0; j < processList->getCount(); j++) {
|
||||
for (size_t j = 0; j < processList->getCount(); j++) {
|
||||
InnerJoinStreamInfo* relationStreamInfo = getStreamInfo(nextRelationship[j]->stream);
|
||||
if (!relationStreamInfo->used) {
|
||||
findBestOrder(position, relationStreamInfo, processList, new_cost, new_cardinality);
|
||||
@ -3364,7 +3363,7 @@ void OptimizerInnerJoin::findBestOrder(int position, InnerJoinStreamInfo* stream
|
||||
|
||||
// Clean up from any changes made for compute the cost for this stream
|
||||
csb->csb_rpt[stream->stream].csb_flags &= ~csb_active;
|
||||
for (i = 0; i < streamFlags.getCount(); i++) {
|
||||
for (size_t i = 0; i < streamFlags.getCount(); i++) {
|
||||
innerStreams[i]->used = streamFlags[i];
|
||||
}
|
||||
}
|
||||
|
@ -7901,7 +7901,6 @@ static void sort_indices_by_selectivity(CompilerScratch::csb_repeat* csb_tail)
|
||||
}
|
||||
|
||||
index_desc* selected_idx = NULL;
|
||||
USHORT i, j;
|
||||
Firebird::Array<index_desc> idx_sort(*JRD_get_thread_data()->getDefaultPool(), csb_tail->csb_indices);
|
||||
bool same_selectivity = false;
|
||||
|
||||
@ -7911,11 +7910,11 @@ static void sort_indices_by_selectivity(CompilerScratch::csb_repeat* csb_tail)
|
||||
|
||||
if (csb_tail->csb_idx && (csb_tail->csb_indices > 1))
|
||||
{
|
||||
for (j = 0; j < csb_tail->csb_indices; j++)
|
||||
for (USHORT j = 0; j < csb_tail->csb_indices; j++)
|
||||
{
|
||||
float selectivity = 1; // Maximum selectivity is 1 (when all keys are the same)
|
||||
index_desc* idx = csb_tail->csb_idx->items;
|
||||
for (i = 0; i < csb_tail->csb_indices; i++)
|
||||
for (USHORT i = 0; i < csb_tail->csb_indices; i++)
|
||||
{
|
||||
// Prefer ASC indices in the case of almost the same selectivities
|
||||
if (selectivity > idx->idx_selectivity) {
|
||||
@ -7937,7 +7936,7 @@ static void sort_indices_by_selectivity(CompilerScratch::csb_repeat* csb_tail)
|
||||
if ((!selected_idx) || (selected_idx->idx_runtime_flags & idx_marker))
|
||||
{
|
||||
idx = csb_tail->csb_idx->items;
|
||||
for (i = 0; i < csb_tail->csb_indices; i++)
|
||||
for (USHORT i = 0; i < csb_tail->csb_indices; i++)
|
||||
{
|
||||
if (!(idx->idx_runtime_flags & idx_marker))
|
||||
{
|
||||
@ -7953,7 +7952,7 @@ static void sort_indices_by_selectivity(CompilerScratch::csb_repeat* csb_tail)
|
||||
|
||||
// Finally store the right order in cbs_tail->csb_idx
|
||||
index_desc* idx = csb_tail->csb_idx->items;
|
||||
for (j = 0; j < csb_tail->csb_indices; j++)
|
||||
for (USHORT j = 0; j < csb_tail->csb_indices; j++)
|
||||
{
|
||||
idx->idx_runtime_flags &= ~idx_marker;
|
||||
memcpy(idx, &idx_sort[j], sizeof(index_desc));
|
||||
|
Loading…
Reference in New Issue
Block a user