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

Commit28b3e39

Browse files
committed
Revertb6002a7
This removes "Add Result Cache executor node". It seems that somethingweird is going on with the tracking of cache hits and misses ashighlighted by many buildfarm animals. It's not yet clear what theproblem is as other parts of the plan indicate that the cache did workcorrectly, it's just the hits and misses that were being reported as 0.This is especially a bad time to have the buildfarm so broken, soreverting before too many more animals go red.Discussion:https://postgr.es/m/CAApHDvq_hydhfovm4=izgWs+C5HqEeRScjMbOgbpC-jRAeK3Yw@mail.gmail.com
1 parentb6002a7 commit28b3e39

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+186
-2823
lines changed

‎contrib/postgres_fdw/expected/postgres_fdw.out

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1602,7 +1602,6 @@ SELECT t1.c1, t2.c2, t3.c3 FROM ft2 t1 LEFT JOIN ft2 t2 ON (t1.c1 = t2.c1) FULL
16021602
20 | 0 | AAA020
16031603
(10 rows)
16041604

1605-
SET enable_resultcache TO off;
16061605
-- right outer join + left outer join
16071606
EXPLAIN (VERBOSE, COSTS OFF)
16081607
SELECT t1.c1, t2.c2, t3.c3 FROM ft2 t1 RIGHT JOIN ft2 t2 ON (t1.c1 = t2.c1) LEFT JOIN ft4 t3 ON (t2.c1 = t3.c1) OFFSET 10 LIMIT 10;
@@ -1629,7 +1628,6 @@ SELECT t1.c1, t2.c2, t3.c3 FROM ft2 t1 RIGHT JOIN ft2 t2 ON (t1.c1 = t2.c1) LEFT
16291628
20 | 0 | AAA020
16301629
(10 rows)
16311630

1632-
RESET enable_resultcache;
16331631
-- left outer join + right outer join
16341632
EXPLAIN (VERBOSE, COSTS OFF)
16351633
SELECT t1.c1, t2.c2, t3.c3 FROM ft2 t1 LEFT JOIN ft2 t2 ON (t1.c1 = t2.c1) RIGHT JOIN ft4 t3 ON (t2.c1 = t3.c1) OFFSET 10 LIMIT 10;
@@ -2141,25 +2139,22 @@ SELECT t1c1, avg(t1c1 + t2c1) FROM (SELECT t1.c1, t2.c1 FROM ft1 t1 JOIN ft2 t2
21412139
-- join with lateral reference
21422140
EXPLAIN (VERBOSE, COSTS OFF)
21432141
SELECT t1."C 1" FROM "S 1"."T 1" t1, LATERAL (SELECT DISTINCT t2.c1, t3.c1 FROM ft1 t2, ft2 t3 WHERE t2.c1 = t3.c1 AND t2.c2 = t1.c2) q ORDER BY t1."C 1" OFFSET 10 LIMIT 10;
2144-
QUERY PLAN
2145-
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2142+
QUERY PLAN
2143+
--------------------------------------------------------------------------------------------------------------------------------------------------------------------
21462144
Limit
21472145
Output: t1."C 1"
21482146
-> Nested Loop
21492147
Output: t1."C 1"
21502148
-> Index Scan using t1_pkey on "S 1"."T 1" t1
21512149
Output: t1."C 1", t1.c2, t1.c3, t1.c4, t1.c5, t1.c6, t1.c7, t1.c8
2152-
-> Result Cache
2153-
Cache Key: t1.c2
2154-
-> Subquery Scan on q
2155-
-> HashAggregate
2156-
Output: t2.c1, t3.c1
2157-
Group Key: t2.c1, t3.c1
2158-
-> Foreign Scan
2159-
Output: t2.c1, t3.c1
2160-
Relations: (public.ft1 t2) INNER JOIN (public.ft2 t3)
2161-
Remote SQL: SELECT r1."C 1", r2."C 1" FROM ("S 1"."T 1" r1 INNER JOIN "S 1"."T 1" r2 ON (((r1."C 1" = r2."C 1")) AND ((r1.c2 = $1::integer))))
2162-
(16 rows)
2150+
-> HashAggregate
2151+
Output: t2.c1, t3.c1
2152+
Group Key: t2.c1, t3.c1
2153+
-> Foreign Scan
2154+
Output: t2.c1, t3.c1
2155+
Relations: (public.ft1 t2) INNER JOIN (public.ft2 t3)
2156+
Remote SQL: SELECT r1."C 1", r2."C 1" FROM ("S 1"."T 1" r1 INNER JOIN "S 1"."T 1" r2 ON (((r1."C 1" = r2."C 1")) AND ((r1.c2 = $1::integer))))
2157+
(13 rows)
21632158

21642159
SELECT t1."C 1" FROM "S 1"."T 1" t1, LATERAL (SELECT DISTINCT t2.c1, t3.c1 FROM ft1 t2, ft2 t3 WHERE t2.c1 = t3.c1 AND t2.c2 = t1.c2) q ORDER BY t1."C 1" OFFSET 10 LIMIT 10;
21652160
C 1

‎contrib/postgres_fdw/sql/postgres_fdw.sql

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -502,12 +502,10 @@ SELECT t1.c1, t2.c2, t3.c3 FROM ft2 t1 FULL JOIN ft2 t2 ON (t1.c1 = t2.c1) LEFT
502502
EXPLAIN (VERBOSE, COSTS OFF)
503503
SELECTt1.c1,t2.c2,t3.c3FROM ft2 t1LEFT JOIN ft2 t2ON (t1.c1=t2.c1) FULLJOIN ft4 t3ON (t2.c1=t3.c1) OFFSET10LIMIT10;
504504
SELECTt1.c1,t2.c2,t3.c3FROM ft2 t1LEFT JOIN ft2 t2ON (t1.c1=t2.c1) FULLJOIN ft4 t3ON (t2.c1=t3.c1) OFFSET10LIMIT10;
505-
SET enable_resultcache TO off;
506505
-- right outer join + left outer join
507506
EXPLAIN (VERBOSE, COSTS OFF)
508507
SELECTt1.c1,t2.c2,t3.c3FROM ft2 t1RIGHT JOIN ft2 t2ON (t1.c1=t2.c1)LEFT JOIN ft4 t3ON (t2.c1=t3.c1) OFFSET10LIMIT10;
509508
SELECTt1.c1,t2.c2,t3.c3FROM ft2 t1RIGHT JOIN ft2 t2ON (t1.c1=t2.c1)LEFT JOIN ft4 t3ON (t2.c1=t3.c1) OFFSET10LIMIT10;
510-
RESET enable_resultcache;
511509
-- left outer join + right outer join
512510
EXPLAIN (VERBOSE, COSTS OFF)
513511
SELECTt1.c1,t2.c2,t3.c3FROM ft2 t1LEFT JOIN ft2 t2ON (t1.c1=t2.c1)RIGHT JOIN ft4 t3ON (t2.c1=t3.c1) OFFSET10LIMIT10;

‎doc/src/sgml/config.sgml

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1770,9 +1770,8 @@ include_dir 'conf.d'
17701770
fact in mind when choosing the value. Sort operations are used
17711771
for <literal>ORDER BY</literal>, <literal>DISTINCT</literal>,
17721772
and merge joins.
1773-
Hash tables are used in hash joins, hash-based aggregation, result
1774-
cache nodes and hash-based processing of <literal>IN</literal>
1775-
subqueries.
1773+
Hash tables are used in hash joins, hash-based aggregation, and
1774+
hash-based processing of <literal>IN</literal> subqueries.
17761775
</para>
17771776
<para>
17781777
Hash-based operations are generally more sensitive to memory
@@ -4926,25 +4925,6 @@ ANY <replaceable class="parameter">num_sync</replaceable> ( <replaceable class="
49264925
</listitem>
49274926
</varlistentry>
49284927

4929-
<varlistentry id="guc-enable-resultcache" xreflabel="enable_resultcache">
4930-
<term><varname>enable_resultcache</varname> (<type>boolean</type>)
4931-
<indexterm>
4932-
<primary><varname>enable_resultcache</varname> configuration parameter</primary>
4933-
</indexterm>
4934-
</term>
4935-
<listitem>
4936-
<para>
4937-
Enables or disables the query planner's use of result cache plans for
4938-
caching results from parameterized scans inside nested-loop joins.
4939-
This plan type allows scans to the underlying plans to be skipped when
4940-
the results for the current parameters are already in the cache. Less
4941-
commonly looked up results may be evicted from the cache when more
4942-
space is required for new entries. The default is
4943-
<literal>on</literal>.
4944-
</para>
4945-
</listitem>
4946-
</varlistentry>
4947-
49484928
<varlistentry id="guc-enable-mergejoin" xreflabel="enable_mergejoin">
49494929
<term><varname>enable_mergejoin</varname> (<type>boolean</type>)
49504930
<indexterm>

‎src/backend/commands/explain.c

Lines changed: 0 additions & 140 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,6 @@ static void show_sort_info(SortState *sortstate, ExplainState *es);
108108
staticvoidshow_incremental_sort_info(IncrementalSortState*incrsortstate,
109109
ExplainState*es);
110110
staticvoidshow_hash_info(HashState*hashstate,ExplainState*es);
111-
staticvoidshow_resultcache_info(ResultCacheState*rcstate,List*ancestors,
112-
ExplainState*es);
113111
staticvoidshow_hashagg_info(AggState*hashstate,ExplainState*es);
114112
staticvoidshow_tidbitmap_info(BitmapHeapScanState*planstate,
115113
ExplainState*es);
@@ -1286,9 +1284,6 @@ ExplainNode(PlanState *planstate, List *ancestors,
12861284
caseT_Material:
12871285
pname=sname="Materialize";
12881286
break;
1289-
caseT_ResultCache:
1290-
pname=sname="Result Cache";
1291-
break;
12921287
caseT_Sort:
12931288
pname=sname="Sort";
12941289
break;
@@ -2001,10 +1996,6 @@ ExplainNode(PlanState *planstate, List *ancestors,
20011996
caseT_Hash:
20021997
show_hash_info(castNode(HashState,planstate),es);
20031998
break;
2004-
caseT_ResultCache:
2005-
show_resultcache_info(castNode(ResultCacheState,planstate),
2006-
ancestors,es);
2007-
break;
20081999
default:
20092000
break;
20102001
}
@@ -3072,137 +3063,6 @@ show_hash_info(HashState *hashstate, ExplainState *es)
30723063
}
30733064
}
30743065

3075-
/*
3076-
* Show information on result cache hits/misses/evictions and memory usage.
3077-
*/
3078-
staticvoid
3079-
show_resultcache_info(ResultCacheState*rcstate,List*ancestors,ExplainState*es)
3080-
{
3081-
Plan*plan= ((PlanState*)rcstate)->plan;
3082-
ListCell*lc;
3083-
List*context;
3084-
StringInfoDatakeystr;
3085-
char*seperator="";
3086-
booluseprefix;
3087-
int64memPeakKb;
3088-
3089-
initStringInfo(&keystr);
3090-
3091-
/*
3092-
* It's hard to imagine having a result cache with fewer than 2 RTEs, but
3093-
* let's just keep the same useprefix logic as elsewhere in this file.
3094-
*/
3095-
useprefix=list_length(es->rtable)>1||es->verbose;
3096-
3097-
/* Set up deparsing context */
3098-
context=set_deparse_context_plan(es->deparse_cxt,
3099-
plan,
3100-
ancestors);
3101-
3102-
foreach(lc, ((ResultCache*)plan)->param_exprs)
3103-
{
3104-
Node*expr= (Node*)lfirst(lc);
3105-
3106-
appendStringInfoString(&keystr,seperator);
3107-
3108-
appendStringInfoString(&keystr,deparse_expression(expr,context,
3109-
useprefix, false));
3110-
seperator=", ";
3111-
}
3112-
3113-
if (es->format!=EXPLAIN_FORMAT_TEXT)
3114-
{
3115-
ExplainPropertyText("Cache Key",keystr.data,es);
3116-
}
3117-
else
3118-
{
3119-
ExplainIndentText(es);
3120-
appendStringInfo(es->str,"Cache Key: %s\n",keystr.data);
3121-
}
3122-
3123-
pfree(keystr.data);
3124-
3125-
if (!es->analyze)
3126-
return;
3127-
3128-
/*
3129-
* mem_peak is only set when we freed memory, so we must use mem_used when
3130-
* mem_peak is 0.
3131-
*/
3132-
if (rcstate->stats.mem_peak>0)
3133-
memPeakKb= (rcstate->stats.mem_peak+1023) /1024;
3134-
else
3135-
memPeakKb= (rcstate->mem_used+1023) /1024;
3136-
3137-
if (es->format!=EXPLAIN_FORMAT_TEXT)
3138-
{
3139-
ExplainPropertyInteger("Cache Hits",NULL,rcstate->stats.cache_hits,es);
3140-
ExplainPropertyInteger("Cache Misses",NULL,rcstate->stats.cache_misses,es);
3141-
ExplainPropertyInteger("Cache Evictions",NULL,rcstate->stats.cache_evictions,es);
3142-
ExplainPropertyInteger("Cache Overflows",NULL,rcstate->stats.cache_overflows,es);
3143-
ExplainPropertyInteger("Peak Memory Usage","kB",memPeakKb,es);
3144-
}
3145-
else
3146-
{
3147-
ExplainIndentText(es);
3148-
appendStringInfo(es->str,
3149-
"Hits: "UINT64_FORMAT" Misses: "UINT64_FORMAT" Evictions: "UINT64_FORMAT" Overflows: "UINT64_FORMAT" Memory Usage: "INT64_FORMAT"kB\n",
3150-
rcstate->stats.cache_hits,
3151-
rcstate->stats.cache_misses,
3152-
rcstate->stats.cache_evictions,
3153-
rcstate->stats.cache_overflows,
3154-
memPeakKb);
3155-
}
3156-
3157-
if (rcstate->shared_info==NULL)
3158-
return;
3159-
3160-
/* Show details from parallel workers */
3161-
for (intn=0;n<rcstate->shared_info->num_workers;n++)
3162-
{
3163-
ResultCacheInstrumentation*si;
3164-
3165-
si=&rcstate->shared_info->sinstrument[n];
3166-
3167-
if (es->workers_state)
3168-
ExplainOpenWorker(n,es);
3169-
3170-
/*
3171-
* Since the worker's ResultCacheState.mem_used field is unavailable
3172-
* to us, ExecEndResultCache will have set the
3173-
* ResultCacheInstrumentation.mem_peak field for us. No need to do
3174-
* the zero checks like we did for the serial case above.
3175-
*/
3176-
memPeakKb= (si->mem_peak+1023) /1024;
3177-
3178-
if (es->format==EXPLAIN_FORMAT_TEXT)
3179-
{
3180-
ExplainIndentText(es);
3181-
appendStringInfo(es->str,
3182-
"Hits: "UINT64_FORMAT" Misses: "UINT64_FORMAT" Evictions: "UINT64_FORMAT" Overflows: "UINT64_FORMAT" Memory Usage: "INT64_FORMAT"kB\n",
3183-
si->cache_hits,si->cache_misses,
3184-
si->cache_evictions,si->cache_overflows,
3185-
memPeakKb);
3186-
}
3187-
else
3188-
{
3189-
ExplainPropertyInteger("Cache Hits",NULL,
3190-
si->cache_hits,es);
3191-
ExplainPropertyInteger("Cache Misses",NULL,
3192-
si->cache_misses,es);
3193-
ExplainPropertyInteger("Cache Evictions",NULL,
3194-
si->cache_evictions,es);
3195-
ExplainPropertyInteger("Cache Overflows",NULL,
3196-
si->cache_overflows,es);
3197-
ExplainPropertyInteger("Peak Memory Usage","kB",memPeakKb,
3198-
es);
3199-
}
3200-
3201-
if (es->workers_state)
3202-
ExplainCloseWorker(n,es);
3203-
}
3204-
}
3205-
32063066
/*
32073067
* Show information on hash aggregate memory usage and batches.
32083068
*/

‎src/backend/executor/Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ OBJS = \
6161
nodeProjectSet.o\
6262
nodeRecursiveunion.o\
6363
nodeResult.o\
64-
nodeResultCache.o\
6564
nodeSamplescan.o\
6665
nodeSeqscan.o\
6766
nodeSetOp.o\

‎src/backend/executor/execAmi.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@
4444
#include"executor/nodeProjectSet.h"
4545
#include"executor/nodeRecursiveunion.h"
4646
#include"executor/nodeResult.h"
47-
#include"executor/nodeResultCache.h"
4847
#include"executor/nodeSamplescan.h"
4948
#include"executor/nodeSeqscan.h"
5049
#include"executor/nodeSetOp.h"
@@ -255,10 +254,6 @@ ExecReScan(PlanState *node)
255254
ExecReScanMaterial((MaterialState*)node);
256255
break;
257256

258-
caseT_ResultCacheState:
259-
ExecReScanResultCache((ResultCacheState*)node);
260-
break;
261-
262257
caseT_SortState:
263258
ExecReScanSort((SortState*)node);
264259
break;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp