X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 35A433CB2CB; Thu, 16 Dec 2004 22:13:24 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 24441-04; Thu, 16 Dec 2004 22:13:13 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 3859A3CB284; Thu, 16 Dec 2004 22:13:14 +0000 (GMT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id iBGMDEBv001870; Thu, 16 Dec 2004 17:13:15 -0500 (EST) To: Adi Alurkar Cc: pgsql-performance@postgresql.org, pgsql-hackers@postgresql.org Subject: Re: UNION ALL vs INHERITANCE In-reply-to: <0393D590-4F9E-11D9-A3E8-000A95C4BD7A@sf.net> References: <0393D590-4F9E-11D9-A3E8-000A95C4BD7A@sf.net> Comments: In-reply-to Adi Alurkar message dated "Thu, 16 Dec 2004 12:06:46 -0800" Date: Thu, 16 Dec 2004 17:13:14 -0500 Message-ID: <1869.1103235194@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.005 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200412/210 X-Sequence-Number: 9585 Adi Alurkar 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