Received: from sss.pgh.pa.us (sss.pgh.pa.us [209.114.132.154]) by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id f290dTx16506 for ; Thu, 8 Mar 2001 19:39:29 -0500 (EST) (envelope-from tgl@sss.pgh.pa.us) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.11.1/8.11.1) with ESMTP id f290dN903067; Thu, 8 Mar 2001 19:39:23 -0500 (EST) To: Kyle cc: pgsql-sql@postgresql.org Subject: Re: A query that doesn't work on 7.1 In-reply-to: <3AA82201.C22A5BAB@actarg.com> References: <3AA6C0AD.BC8A015A@actarg.com> <19632.984010093@sss.pgh.pa.us> <24466.984016499@sss.pgh.pa.us> <3AA7E16D.C9B4FA76@actarg.com> <29675.984081236@sss.pgh.pa.us> <3AA82201.C22A5BAB@actarg.com> Comments: In-reply-to Kyle message dated "Thu, 08 Mar 2001 17:21:22 -0700" Date: Thu, 08 Mar 2001 19:39:23 -0500 Message-ID: <3064.984098363@sss.pgh.pa.us> From: Tom Lane X-Archive-Number: 200103/186 X-Sequence-Number: 1839 Kyle writes: >> You could probably gin up a usable avg(timestamp) using the avg(float8) >> routines, since a timestamp is really just a double under the hood. > When you say "gin up" are you talking about C, PL/XXX, or just casts? I was thinking of full-scale cheating: make a new pg_aggregate entry for avg(timestamp) that points at the existing pg_proc entries that support avg(float8). CREATE AGGREGATE won't do this for you, but there's always good old INSERT INTO ... > Here's a view of a union. The two selects are fast when executed > individually (and explain confirms that they use indexes). When I > query the view, though, it is slow (explain says the scans are > sequential). > Is this expected or a bug? Seems odd. Need enough info to reproduce, please? regards, tom lane