| From: | Sami Imseih <samimseih(at)gmail(dot)com> |
|---|---|
| To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
| Cc: | Jeff Davis <pgsql(at)j-davis(dot)com>, David Rowley <dgrowleyml(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org |
| Subject: | Re: Should work_mem be stable for a prepared statement? |
| Date: | 2025-02-28 23:18:29 |
| Message-ID: | CAA5RZ0sp7gga74Z0aQeodFDFF70dEHrBQsiVnEyVPBuKtJL7Vw@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
> I'm also not convinced that the argument requires us to solve
> the problem by re-planning. It would work just as well to stamp
> each PlannedStmt with the value that the planner used and
> refer to that in the executor instead of looking directly at the GUC.
hmm, if work_mem influences the plan, can we really avoid re-planning?
Here is an example where re-plannning is required to yield a plan
that is based on the current work_mem. right?
postgres=# show work_mem ;
work_mem
----------
4MB
(1 row)
postgres=# prepare sortprep as select * from pg_class order by oid ;
PREPARE
postgres=# explain execute sortprep;
QUERY PLAN
-------------------------------------------------------------------
Sort (cost=36.20..37.23 rows=415 width=273)
Sort Key: oid
-> Seq Scan on pg_class (cost=0.00..18.15 rows=415 width=273)
(3 rows)
postgres=# set work_mem = "64kB";
SET
postgres=# explain execute sortprep;
QUERY PLAN
-------------------------------------------------------------------
Sort (cost=36.20..37.23 rows=415 width=273)
Sort Key: oid
-> Seq Scan on pg_class (cost=0.00..18.15 rows=415 width=273)
(3 rows)
postgres=# explain select * from pg_class order by oid ;
QUERY PLAN
----------------------------------------------------------------------------------------
Index Scan using pg_class_oid_index on pg_class (cost=0.27..60.85
rows=415 width=273)
(1 row)
--
Sami
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Thomas Munro | 2025-02-28 23:38:37 | Re: [PoC] Federated Authn/z with OAUTHBEARER |
| Previous Message | Jeff Davis | 2025-02-28 23:05:10 | Re: [18] CREATE SUBSCRIPTION ... SERVER |