Re: EXPLAIN (ANALYZE, BUFFERS) - puzzling numbers for a simple query.

From: Pól Ua Laoínecháin <linehanp(at)tcd(dot)ie>
To:
Cc: PostgreSQL General <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: EXPLAIN (ANALYZE, BUFFERS) - puzzling numbers for a simple query.
Date: 2021-06-04 14:16:22
Message-ID: CAF4RT5Q5pUb5_S1NK-Q7_o76anP7Kt6aFjxwhv7QNVpGtc+C0w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at> writes:

> > "generate_series" has a support function from v12 on:

> True, but I don't think it can do anything with non-constant inputs,
> as we have in the OP's case.

As confirmed by this:

https://dbfiddle.uk/?rdbms=postgres_12&fiddle=d0b70717faca3b094be8b4a096758b94

Plan:

==============
Sort (cost=623.22..640.72 rows=7000 width=10) (actual
time=0.067..0.070 rows=42 loops=1)
Sort Key: id, (((generate_series((start_date)::timestamp with time
zone, (end_date)::timestamp with time zone, '1
day'::interval)))::date)
Sort Method: quicksort Memory: 26kB
Buffers: shared hit=1
-> Result (cost=0.00..176.16 rows=7000 width=10) (actual
time=0.014..0.045 rows=42 loops=1)
Buffers: shared hit=1
-> ProjectSet (cost=0.00..36.16 rows=7000 width=14) (actual
time=0.013..0.033 rows=42 loops=1)
CUT
==============

It goes for the full 7,000 even after a VACUUM FULL VERBOSE ANALYZE test;

Pól...

> regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2021-06-04 14:24:12 Re: BUG #17046: Upgrade postgres 11 to 13 version
Previous Message Tom Lane 2021-06-04 14:11:20 Re: strange behavior of WAL files