Re: analyzing intermediate query - Mailing list pgsql-performance

From Andrus
Subject Re: analyzing intermediate query
Date
Msg-id 72246E216337406EAD285F5A45533672@andrusnotebook
Whole thread Raw
In response to Re: analyzing intermediate query  (PFC <lists@peufeu.com>)
Responses Re: analyzing intermediate query
List pgsql-performance
> Oh, I just thought about something, I don't remember in which version it
> was added, but :
>
> EXPLAIN ANALYZE SELECT sum(column1) FROM (VALUES ...a million
> ntegers...  ) AS v
>
> Postgres is perfectly happy with that ; it's either a bit slow (about 1
> second) or very fast depending on how you view things...

I tried in 8.1.4

select * from (values (0)) xx

but got

ERROR: syntax error at or near ")"
SQL state: 42601
Character: 26

Even if this works this may be not solution: I need to apply distinct to
temporary table. Temporary table may contain duplicate values and without
DISTINCT join produces invalid result.
Temporary table itself is created from data from server tables, it is not
generated from list.

I can use

SELECT dok.*
 FROM dok
WHERE dokumnr IN  (SELECT dokumnr FROM  temptbl)

but this seems never use bitmap index scan in 8.1.4

Sadly, creating second temporary table from first temporary table specially
for this query seems to be only solution.

When materialized row count will be added so that statistics is exact and
select count(*) from tbl runs fast ?

Andrus.


pgsql-performance by date:

Previous
From: PFC
Date:
Subject: Re: analyzing intermediate query
Next
From: "Daniel Cristian Cruz"
Date:
Subject: Fwd: Not so simple query and a half million loop