| Lists: | pgsql-hackers |
|---|
| From: | Andreas Karlsson <andreas(at)proxel(dot)se> |
|---|---|
| To: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
| Subject: | \x auto and EXPLAIN |
| Date: | 2016-01-03 09:36:14 |
| Message-ID: | 5688EB8E.5060901@proxel.se |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Lists: | pgsql-hackers |
Hi,
psql's "\x auto" is a nice feature, but it is made much less useful in
my opinion due to the expanded output format making query plans
unreadable (and query plans often end up using expanded display due to
their width). I think we should never use the expanded format for
EXPLAIN output in the "\x auto" mode, since even when the wrapped format
is used the query plans are very hard to read.
I see two ways to fix this.
1) Never use expanded display for the case where there is only one
column. There seems to me like there is little value in using expanded
display for when you only have one column, but I may be missing some use
case here.
2) Explicitly detect (for example based on the headers) that the result
is a query plan and if so disable expanded display.
I have attached a trivial patch for each solution.
Andreas
| Attachment | Content-Type | Size |
|---|---|---|
| x-auto-alt1.patch | text/x-diff | 636 bytes |
| x-auto-alt2.patch | text/x-diff | 1.0 KB |
| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
|---|---|
| To: | Andreas Karlsson <andreas(at)proxel(dot)se> |
| Cc: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
| Subject: | Re: \x auto and EXPLAIN |
| Date: | 2016-01-03 17:43:39 |
| Message-ID: | 26519.1451843019@sss.pgh.pa.us |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Lists: | pgsql-hackers |
Andreas Karlsson <andreas(at)proxel(dot)se> writes:
> psql's "\x auto" is a nice feature, but it is made much less useful in
> my opinion due to the expanded output format making query plans
> unreadable (and query plans often end up using expanded display due to
> their width). I think we should never use the expanded format for
> EXPLAIN output in the "\x auto" mode, since even when the wrapped format
> is used the query plans are very hard to read.
> I see two ways to fix this.
> 1) Never use expanded display for the case where there is only one
> column. There seems to me like there is little value in using expanded
> display for when you only have one column, but I may be missing some use
> case here.
> 2) Explicitly detect (for example based on the headers) that the result
> is a query plan and if so disable expanded display.
The second of these seems pretty bletcherous --- for one thing, it might
fall foul of localization attempts. However, I could see the argument
for not using expanded mode for any single-column output.
regards, tom lane
| From: | "Shulgin, Oleksandr" <oleksandr(dot)shulgin(at)zalando(dot)de> |
|---|---|
| To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
| Cc: | Andreas Karlsson <andreas(at)proxel(dot)se>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
| Subject: | Re: \x auto and EXPLAIN |
| Date: | 2016-01-04 10:38:01 |
| Message-ID: | CACACo5RxutP_XbB0E0i5W+byOF5rOxJ5HwnXkC6G6upS2MQgMg@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Lists: | pgsql-hackers |
On Sun, Jan 3, 2016 at 6:43 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Andreas Karlsson <andreas(at)proxel(dot)se> writes:
> > psql's "\x auto" is a nice feature, but it is made much less useful in
> > my opinion due to the expanded output format making query plans
> > unreadable (and query plans often end up using expanded display due to
> > their width). I think we should never use the expanded format for
> > EXPLAIN output in the "\x auto" mode, since even when the wrapped format
> > is used the query plans are very hard to read.
>
> > I see two ways to fix this.
>
> > 1) Never use expanded display for the case where there is only one
> > column. There seems to me like there is little value in using expanded
> > display for when you only have one column, but I may be missing some use
> > case here.
>
> > 2) Explicitly detect (for example based on the headers) that the result
> > is a query plan and if so disable expanded display.
>
> The second of these seems pretty bletcherous --- for one thing, it might
> fall foul of localization attempts. However, I could see the argument
> for not using expanded mode for any single-column output.
>
+1 to option #1, I sympathize to this as an annoyance that can be easily
fixed.
--
Alex
| From: | Andreas Karlsson <andreas(at)proxel(dot)se> |
|---|---|
| To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
| Cc: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
| Subject: | Re: \x auto and EXPLAIN |
| Date: | 2016-01-04 14:33:06 |
| Message-ID: | 568A82A2.2030007@proxel.se |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Lists: | pgsql-hackers |
On 01/03/2016 06:43 PM, Tom Lane wrote:
>> I see two ways to fix this.
>
>> 1) Never use expanded display for the case where there is only one
>> column. There seems to me like there is little value in using expanded
>> display for when you only have one column, but I may be missing some use
>> case here.
>
>> 2) Explicitly detect (for example based on the headers) that the result
>> is a query plan and if so disable expanded display.
>
> The second of these seems pretty bletcherous --- for one thing, it might
> fall foul of localization attempts. However, I could see the argument
> for not using expanded mode for any single-column output.
I too prefer the first option, and hope I have not missed a case for
when having "\x auto" give expanded display with a single column is a
clear gain. For the cases I have seen myself it has always been a
usability loss (minor or great).
Andreas
| From: | Robert Haas <robertmhaas(at)gmail(dot)com> |
|---|---|
| To: | Andreas Karlsson <andreas(at)proxel(dot)se> |
| Cc: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
| Subject: | Re: \x auto and EXPLAIN |
| Date: | 2016-03-11 13:05:28 |
| Message-ID: | CA+TgmoaEuFP7xvgi+vX=KdXcAfSO+txcCwtXNi7Hb0K_0mG2rA@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Lists: | pgsql-hackers |
On Sun, Jan 3, 2016 at 4:36 AM, Andreas Karlsson <andreas(at)proxel(dot)se> wrote:
> psql's "\x auto" is a nice feature, but it is made much less useful in my
> opinion due to the expanded output format making query plans unreadable (and
> query plans often end up using expanded display due to their width). I think
> we should never use the expanded format for EXPLAIN output in the "\x auto"
> mode, since even when the wrapped format is used the query plans are very
> hard to read.
>
> I see two ways to fix this.
>
> 1) Never use expanded display for the case where there is only one column.
> There seems to me like there is little value in using expanded display for
> when you only have one column, but I may be missing some use case here.
>
> 2) Explicitly detect (for example based on the headers) that the result is a
> query plan and if so disable expanded display.
>
> I have attached a trivial patch for each solution.
Committed #1 after updating the comments and adding documentation.
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company