Re: No access to TOAST tables shown in EXPLAIN ( ANALYZE, BUFFERS ) - Mailing list pgsql-bugs

From Tom Lane
Subject Re: No access to TOAST tables shown in EXPLAIN ( ANALYZE, BUFFERS )
Date
Msg-id 2586583.1643295137@sss.pgh.pa.us
Whole thread Raw
In response to No access to TOAST tables shown in EXPLAIN ( ANALYZE, BUFFERS )  (Christophe Courtois <christophe.courtois@dalibo.com>)
List pgsql-bugs
Christophe Courtois <christophe.courtois@dalibo.com> writes:
> I've found that EXPLAIN (ANALYZE,BUFFERS) does not show any access to the TOAST tables when a toasted column is only
SELECTedand not used in any way in the query. 

This is probably because of the documented, long-standing behavior that
EXPLAIN does not convert the query's output rows to text, nor send them
to the client.  If the datatype output functions aren't called, the
output datums won't get detoasted either.

I don't see anything here we want to change.  The argument for not
bothering to model output costs has always been that they'd be the
same for every possible query plan, and I think that that applies to
detoasting costs as much as the actual output conversions.  Moreover,
if we're not sending data to the client, the skipped network I/O could
easily represent a larger cost than anything else --- but there's no
reasonable way to account for that.

If you do care about those costs, a possible answer is to run
auto_explain, allowing you to capture data behind-the-scenes for
queries that really are sending data to clients.

            regards, tom lane



pgsql-bugs by date:

Previous
From: Bharath Rupireddy
Date:
Subject: Re: BUG #17375: RECOVERY TARGET TIME RESTORE IS FAILING TO START SERVER
Next
From: PG Bug reporting form
Date:
Subject: BUG #17384: ERROR: missing chunk number 0 for toast value 152073604 in pg_toast_2619