Re: UNION ALL vs INHERITANCE - Mailing list pgsql-performance

From Tom Lane
Subject Re: UNION ALL vs INHERITANCE
Date
Msg-id 1869.1103235194@sss.pgh.pa.us
Whole thread Raw
In response to UNION ALL vs INHERITANCE  (Adi Alurkar <adi@sf.net>)
List pgsql-performance
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

pgsql-performance by date:

Previous
From: Adi Alurkar
Date:
Subject: UNION ALL vs INHERITANCE
Next
From: David Brown
Date:
Subject: Re: Seqscan rather than Index