Re: automatic analyze: readahead - add "IO read time" log message

From: Stephen Frost <sfrost(at)snowman(dot)net>
To: Tomas Vondra <tomas(dot)vondra(at)enterprisedb(dot)com>
Cc: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>, Jakub Wartak <Jakub(dot)Wartak(at)tomtom(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: automatic analyze: readahead - add "IO read time" log message
Date: 2021-03-08 19:42:53
Message-ID: 20210308194253.GG20766@tamriel.snowman.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Greetings,

* Tomas Vondra (tomas(dot)vondra(at)enterprisedb(dot)com) wrote:
> On 2/10/21 11:10 PM, Stephen Frost wrote:
> > * Heikki Linnakangas (hlinnaka(at)iki(dot)fi) wrote:
> >> On 05/02/2021 23:22, Stephen Frost wrote:
> >>> Unless there's anything else on this, I'll commit these sometime next
> >>> week.
> >>
> >> One more thing: Instead of using 'effective_io_concurrency' GUC directly,
> >> should call get_tablespace_maintenance_io_concurrency().
> >
> > Ah, yeah, of course.
> >
> > Updated patch attached.
>
> A couple minor comments:
>
> 1) I think the patch should be split into two parts, one adding the
> track_io_timing, one adding the prefetching.

This was already done..

> 2) I haven't tried but I'm pretty sure there'll be a compiler warning
> about 'prefetch_maximum' being unused without USE_PREFETCH defined.

Ah, that part is likely true, moved down into the #ifdef block to
address that, which also is good since it should avoid mistakenly using
it outside of the #ifdef's later on by mistake too.

> 3) Is there a way to reduce the amount of #ifdef in acquire_sample_rows?

Perhaps..

> This makes the code rather hard to read, IMHO. It seems to me we can
> move the code around a bit and merge some of the #ifdef blocks - see the
> attached patch. Most of this is fairly trivial, with the exception of
> moving PrefetchBuffer before table_scan_analyze_next_block - AFAIK this
> does not materially change the behavior, but perhaps I'm wrong.

but I don't particularly like doing the prefetch right before we run
vacuum_delay_point() and potentially sleep.

Rebased and updated patch attached.

Thanks!

Stephen

Attachment Content-Type Size
analyze_prefetch_v8.patch text/x-diff 13.0 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David G. Johnston 2021-03-08 19:47:31 Re: About to add WAL write/fsync statistics to pg_stat_wal view
Previous Message Joel Jacobson 2021-03-08 19:41:03 Re: [PATCH] regexp_positions ( string text, pattern text, flags text ) → setof int4range[]