Skip to content

Commit

Permalink
Fixed CORE-2659: Sub-optimal (not indexed) query plan for outer joins…
Browse files Browse the repository at this point in the history
… involving complex views.

We don't need to validate all the view streams inside the optimizer, just those inside the e_derived_expr_expr argument.
  • Loading branch information
dyemanov committed Oct 3, 2009
1 parent e356aae commit 3a3512d
Showing 1 changed file with 0 additions and 43 deletions.
43 changes: 0 additions & 43 deletions src/jrd/Optimizer.cpp
Expand Up @@ -171,32 +171,6 @@ bool OPT_computable(CompilerScratch* csb, const jrd_nod* node, SSHORT stream,
}
return csb->csb_rpt[n].csb_flags & csb_active;

case nod_derived_expr:
{
const UCHAR streamCount = (UCHAR)(IPTR) node->nod_arg[e_derived_expr_stream_count];
const USHORT* streamList = (USHORT*) node->nod_arg[e_derived_expr_stream_list];
bool active = true;

for (UCHAR i = 0; i < streamCount; ++i)
{
n = streamList[i];
if (allowOnlyCurrentStream)
{
if (n != stream && !(csb->csb_rpt[n].csb_flags & csb_sub_stream))
return false;
}
else
{
if (n == stream)
return false;
}

active = active && (csb->csb_rpt[n].csb_flags & csb_active);
}

return active;
}

case nod_min:
case nod_max:
case nod_average:
Expand Down Expand Up @@ -1118,23 +1092,6 @@ void OptimizerRetrieval::findDependentFromStreams(const jrd_nod* node,
return;
}

case nod_derived_expr:
{
const UCHAR derivedStreamCount = (UCHAR)(IPTR) node->nod_arg[e_derived_expr_stream_count];
const USHORT* derivedStreamList = (USHORT*) node->nod_arg[e_derived_expr_stream_list];

for (UCHAR i = 0; i < derivedStreamCount; ++i)
{
const int keyStream = derivedStreamList[i];
if (keyStream != stream && (csb->csb_rpt[keyStream].csb_flags & csb_active))
{
if (!streamList->exist(keyStream))
streamList->add(keyStream);
}
}
return;
}

case nod_min:
case nod_max:
case nod_average:
Expand Down

0 comments on commit 3a3512d

Please sign in to comment.