Re: Materialiation is slower than non-materialized

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Rajeev rastogi <rajeev(dot)rastogi(at)huawei(dot)com>
Cc: PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Materialiation is slower than non-materialized
Date: 2015-03-23 16:08:58
Message-ID: CA+TgmoZBOVJBXUuiGZ6hOBLYnLONdwYw-G4ekA6bbi6F9ipYyQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Mar 23, 2015 at 6:01 AM, Rajeev rastogi
<rajeev(dot)rastogi(at)huawei(dot)com> wrote:
> The cost of re-scan of SeqScan node is considered to be same scan of SeqScan
> node, which always assumes that the records is fetched from disk and hence
> disk access cost is added (As we don’t know really how much memory will be
> available to cache during execution).

That's a general problem not limited to materialize nodes. We might
choose to do a heap-sort rather than a quick-sort, but it may turn out
that the "tapes" we create end up in the OS buffer cache instead of on
physical storage; in fact, it's probably the common case. Scans are
costed using seq_page_cost and random_page_cost, but most of the time
the "random" page cost will not be the cost of a head seek, because
we'll find the data in the OS page cache. Some of the time it really
will be a head seek, but we have no idea whether that will happen in
any given case. The autovacuum cost delays have this problem too: a
"miss" in shared buffers may really be a hit in the OS page cache, but
we don't know.

> This e-mail and its attachments contain confidential information from
> HUAWEI, which
> is intended only for the person or entity whose address is listed above. Any
> use of the
> information contained herein in any way (including, but not limited to,
> total or partial
> disclosure, reproduction, or dissemination) by persons other than the
> intended
> recipient(s) is prohibited. If you receive this e-mail in error, please
> notify the sender by
> phone or email immediately and delete it!

This kind of disclaimer is inappropriate on a public mailing list.
Don't send confidential information to public mailing lists. You
probably don't have any legal right to control what happens to it
after that, regardless of what you put in your email.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2015-03-23 16:11:35 Re: pg_dump quietly ignore missing tables - is it bug?
Previous Message Robert Haas 2015-03-23 15:48:21 Re: Superuser connect during smart shutdown