Re: EXPLAIN CREATE TABLE AS

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PG Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: EXPLAIN CREATE TABLE AS
Date: 2008-10-23 13:40:54
Message-ID: 49007EE6.5070707@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom Lane wrote:
> Peter Eisentraut <peter_e(at)gmx(dot)net> writes:
>> It turns out you cannot EXPLAIN on CREATE TABLE AS, but it seems to work
>> fine if I extend the grammar as below:
>
> This seems to me to be something that will look like a wart, not a
> feature, from the user's point of view. You can't explain CREATE TABLE,
> but you can explain CREATE TABLE AS? It's just weird. It feels to me
> like exposing an implementation artifact.

Isn't the whole point of EXPLAIN to expose implementation artifacts in
the first place? It shows the plan associated with a plannable
statement. Why are some statements plannable and some not? Why can you
explain DELETE and not TRUNCATE? Why can you explain INSERT, what is
plannable about that? Ah, there is INSERT ... SELECT. If you can plan
INSERT, can you plan SELECT INTO, right? Yes, that works. But CREATE
TABLE AS is the same, why won't that work? Should we prohibit
explaining SELECT INTO? So you can't explain SELECT INTO, but you can
explain SELECT? It's all very weird.

So it's not like this is not already quite implementation-dependent. We
expose the information that we have and let the user process it.
Someone who has advanced to the level of using EXPLAIN should be able to
tell the difference, and those who are maximally confused won't be
harmed by this addition any more than they already are.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2008-10-23 13:52:51 Re: Unicode escapes in literals
Previous Message Dimitri Fontaine 2008-10-23 13:37:45 Re: EXPLAIN CREATE TABLE AS