pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andrus <kobruleht2@hot.ee>
To: pgsql-performance@postgresql.org
To: PFC <lists@peufeu.com>
Subject: Re: analyzing intermediate query
Date: Tue, 2 Dec 2008 17:50:53 +0200
Message-ID: <72246E216337406EAD285F5A45533672@andrusnotebook> (raw)
In-Reply-To: <op.uljja8egcigqcu@soyouz>
References: <gh38cg$1544$1@news.hub.org>
	<op.uljfbad8cigqcu@soyouz>
	<B52A6C218D2145378337CFDC89699D99@andrusnotebook>
	<op.uljghcfxcigqcu@soyouz>
	<95776070DDC841978DF8335DCF59D6BB@andrusnotebook>
	<op.uljja8egcigqcu@soyouz>

> 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. 




view thread (10+ messages)  latest in thread

Message-ID: <72246E216337406EAD285F5A45533672@andrusnotebook>
Permalink:  ../72246E216337406EAD285F5A45533672@andrusnotebook/
Also on:    postgresql.org/message-id/72246E216337406EAD285F5A45533672@andrusnotebook

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: kobruleht2@hot.ee, lists@peufeu.com
  Subject: Re: analyzing intermediate query
  In-Reply-To: <72246E216337406EAD285F5A45533672@andrusnotebook>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox