Kyle <kyle@actarg.com> 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