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
Subject: analyzing intermediate query
Date: Tue, 2 Dec 2008 14:06:36 +0200
Message-ID: <gh38cg$1544$1@news.hub.org> (raw)

I noticed that query

SELECT dok.*
 FROM dok
JOIN  (SELECT DISTINCT dokumnr FROM  temptbl ) x USING(dokumnr);

is slow in 8.1.4
I cannot use explain analyze since this query uses results from temporary 
table temptbl which is not available.

Sometimes innter table returns only 1 row so maybe seq scan is selected 
instead of single row index access becauses expected count is 1000

As I understand, PostgreSql requires manually running ANALYZE for temporary 
tables if their row count is different from 1000

How to force PostgreSql to analyze inner table in this query or use other 
way to get index using query plan if inner query returns single row ?

How 




view thread (10+ messages)  latest in thread

Message-ID: <gh38cg$1544$1@news.hub.org>
Permalink:  ../gh38cg$1544$1@news.hub.org/
Also on:    postgresql.org/message-id/gh38cg$1544$1@news.hub.org

 · 

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
  Subject: Re: analyzing intermediate query
  In-Reply-To: <gh38cg$1544$1@news.hub.org>

* 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