From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Erik Wienhold <ewie(at)ewie(dot)name> |
Cc: | Greg Sabino Mullane <htamfids(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: psql: Count all table footer lines in pager setup |
Date: | 2025-10-06 21:14:35 |
Message-ID: | 2164180.1759785275@sss.pgh.pa.us |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Erik Wienhold <ewie(at)ewie(dot)name> writes:
> On 2025-10-02 00:25 +0200, Tom Lane wrote:
>> I am not entirely sure that we should commit 0002 though; it may be
>> that the savings is down in the noise anyway once you consider all
>> the other work that happens while printing a big table.
> I see larger gains for queries that produce cells with many newlines,
> benchmarked with a variation of my test-psql-pager.py script from
> upthread. ...
> Based on that I think you should push v4-0002.
OK, we'll keep it.
As I was doing some desultory manual testing, I realized that v4
still has a notable gap: it fails to account for the "(n rows)"
default footer. That's because that is not present in cont->footers
but is manually injected by footers_with_default, and count_table_rows
wasn't dealing with that. It's a little more complicated than just
calling that function, because the various vertical modes don't use
the default footer. After some code study I decided that we could
use the existing "expanded" flag to decide which footer definition
to apply, but I decided to rename it to "vertical" to reduce confusion
with the not-a-boolean cont->opt->expanded field.
Despite all this hackery, the count is still only really accurate
for the "\pset format aligned" modes. I figure we can leave
tidying up the other modes for another day, because I doubt that
anybody cares about interactive output of, say, LaTeX format.
(Perhaps unaligned mode would be the first priority to tidy up.)
Another inaccuracy that I find mildly annoying now that we've got it
mostly right is that we are not accounting for the blank line that
psql likes to print after the query result, so that you can still
end with the first output line scrolled off your screen despite
non-use of the pager. Not sure about a non-kluge way to count that,
though: it's outside the domain of print.c, and other callers might
not have a similar behavior.
I cleaned up the TAP test, too. This version redirects PAGER
to "wc -l", so that it's very obvious from the output whether
or not the pager was used.
regards, tom lane
Attachment | Content-Type | Size |
---|---|---|
v5-0001-Improve-psql-s-ability-to-select-pager-mode-accur.patch | text/x-diff | 11.1 KB |
v5-0002-Make-some-minor-performance-improvements-in-psql-.patch | text/x-diff | 8.1 KB |
v5-0003-Add-a-TAP-test-to-exercise-psql-s-use-of-the-page.patch | text/x-diff | 4.3 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Andres Freund | 2025-10-06 21:27:12 | Re: Should we update the random_page_cost default value? |
Previous Message | Masahiko Sawada | 2025-10-06 21:03:44 | Re: GIN tries to form a tuple with a partial compressedList during insertion |