pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Adi Alurkar <adi@sf.net>
Cc: pgsql-performance@postgresql.org
Cc: pgsql-hackers@postgresql.org
Subject: Re: UNION ALL vs INHERITANCE
Date: Thu, 16 Dec 2004 17:13:14 -0500
Message-ID: <1869.1103235194@sss.pgh.pa.us> (raw)
In-Reply-To: <0393D590-4F9E-11D9-A3E8-000A95C4BD7A@sf.net>
References: <0393D590-4F9E-11D9-A3E8-000A95C4BD7A@sf.net>

Adi Alurkar <adi@sf.net> writes:
> Why does the append resulting from a inheritance take longer than one  
> resulting from  UNION ALL?

The index scan is where the time difference is:

>                       ->  Index Scan using fftiallbgrgfid_1102715649 on  
> f_f_all_base  (cost=0.00..3.52 rows=1 width=51) (actual  
> time=3.871..244.356 rows=28 loops=1)
>                             Index Cond: (group_id = 78745)
>                             Filter: (all_tidx @@ '\'mmcach\''::tsquery)

>                       ->  Index Scan using fftiallbgrgfid_1102715649 on  
> f_f_all_base  (cost=0.00..3.52 rows=1 width=51) (actual  
> time=3.714..79.996 rows=28 loops=1)
>                             Index Cond: (group_id = 78745)
>                             Filter: (all_tidx @@ '\'mmcach\''::tsquery)

One would have to suppose this is a caching effect, ie, the data is
already in RAM on the second try and doesn't have to be read from disk
again.

			regards, tom lane



view thread (2+ messages)

Message-ID: <1869.1103235194@sss.pgh.pa.us>
Permalink:  ../1869.1103235194@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/1869.1103235194@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: tgl@sss.pgh.pa.us, adi@sf.net, pgsql-hackers@postgresql.org
  Subject: Re: UNION ALL vs INHERITANCE
  In-Reply-To: <1869.1103235194@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox