Re: Disk wait problem... may not be hardware... - Mailing list pgsql-general

From Peter J. Holzer
Subject Re: Disk wait problem... may not be hardware...
Date
Msg-id 20231029150046.zkoicc6g4247mzwm@hjp.at
Whole thread Raw
In response to Re: Disk wait problem... may not be hardware...  (pf@pfortin.com)
Responses Re: Disk wait problem... may not be hardware...  (pf@pfortin.com)
List pgsql-general
On 2023-10-27 19:46:09 -0400, pf@pfortin.com wrote:
> On Fri, 27 Oct 2023 19:07:11 +0200 Peter J. Holzer wrote:
> >Have you looked at the query plans as I recommended? (You might also
> >want to enable track_io_timing to get extra information, but comparing
> >just the query plans of fast and slow queries would be a first step)
>
> I didn't see how that would help since other than the table name the
> queries are identical.  Curious: are you implying PG stores tables
> differently?

No, but Postgres decides on the query depending on the statistics stored
about that table. If those statistics are off, the query plan can be
wildly different and very inefficient. So checking whether the plans are
plausible should be one of the first things you do when performance is
not what you expect. Indeed, on
https://wiki.postgresql.org/wiki/Slow_Query_Questions it is the very
first bullet point in the section "Things to Try Before You Post".

When you have established that the plan looks fine even when the
performance is poor then you have to look elsewhere. But even then it
helps to know what the database is actually trying to do.

        hp



--
   _  | Peter J. Holzer    | Story must make more sense than reality.
|_|_) |                    |
| |   | hjp@hjp.at         |    -- Charles Stross, "Creative writing
__/   | http://www.hjp.at/ |       challenge!"

Attachment

pgsql-general by date:

Previous
From: pf@pfortin.com
Date:
Subject: [SOLVED?] Re: Disk wait problem... not hardware...
Next
From: Paul Förster
Date:
Subject: Re: pg_checksums?