Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite8be8ff

Browse files
committed
Further tweaking of logic that decides when to materialize an uncorrelated
subplan: do it if subplan has subplans itself, and always do it if thesubplan is an indexscan. (I originally set it to materialize an indexscanonly if the indexqual is fairly selective, but I dunno what I wasthinking ... an unselective indexscan is still expensive ...)
1 parentbbe1ff7 commite8be8ff

File tree

1 file changed

+15
-24
lines changed

1 file changed

+15
-24
lines changed

‎src/backend/optimizer/plan/subselect.c

Lines changed: 15 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1994, Regents of the University of California
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/subselect.c,v 1.29 2000/03/02 04:08:16 tgl Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/subselect.c,v 1.30 2000/03/11 23:53:41 tgl Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -302,8 +302,8 @@ make_subplan(SubLink *slink)
302302
* the top of an uncorrelated/undirect correlated subplan, which lets
303303
* us do the work of evaluating the subplan only once. We do this
304304
* if the subplan's top plan node is anything more complicated than
305-
* a sequentialor indexscan, and we do it even forthose plan types
306-
*if thequal appears selective enough to eliminate many tuples.
305+
* aplainsequential scan, and we do it even forseqscan if the
306+
* qual appears selective enough to eliminate many tuples.
307307
*/
308308
if (node->parParam==NIL)
309309
{
@@ -312,28 +312,19 @@ make_subplan(SubLink *slink)
312312
switch (nodeTag(plan))
313313
{
314314
caseT_SeqScan:
315-
{
316-
Selectivityqualsel;
317-
318-
qualsel=clauselist_selectivity(subquery,plan->qual,0);
319-
/* Is 10% selectivity a good threshold?? */
320-
use_material=qualsel<0.10;
321-
break;
322-
}
323-
caseT_IndexScan:
324-
{
325-
List*indxqual= ((IndexScan*)plan)->indxqualorig;
326-
Selectivityqualsel;
327-
328-
qualsel=clauselist_selectivity(subquery,plan->qual,0);
329-
qualsel *=clauselist_selectivity(subquery,indxqual,0);
330-
/* Note: if index is lossy, we just double-counted the
331-
* index selectivity. Worth fixing?
332-
*/
333-
/* Is 10% selectivity a good threshold?? */
334-
use_material=qualsel<0.10;
315+
if (plan->initPlan||plan->subPlan)
316+
use_material= true;
317+
else
318+
{
319+
Selectivityqualsel;
320+
321+
qualsel=clauselist_selectivity(subquery,
322+
plan->qual,
323+
0);
324+
/* Is 10% selectivity a good threshold?? */
325+
use_material=qualsel<0.10;
326+
}
335327
break;
336-
}
337328
caseT_Material:
338329
caseT_Sort:
339330
/* Don't add another Material node if there's one already,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp