pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andrus <kobruleht2@hot.ee>
To: Gregory Stark <stark@enterprisedb.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: seq scan over 3.3 million rows instead of single key index access
Date: Sun, 23 Nov 2008 06:20:08 +0200
Message-ID: <3D5FFE56C89B4D55956907DD7C712F42@andrusnotebook> (raw)
In-Reply-To: <87k5avz7l5.fsf@oxford.xeocode.com>
References: <gg9pg7$1edv$2@news.hub.org>
	<87k5avz7l5.fsf@oxford.xeocode.com>

Gregory,

>  I would suggest running ANALYZE
> idtellUued at some point before the problematic query.

Thank you.
After adding analyze all is OK.
Is analyze command required in  8.3 also ?
Or is it better better to specify some hint at create temp table time since 
I know the number of rows before running query ?

Andrus.

set search_path to firma2,public;
 CREATE TEMP TABLE idtellUued(dokumnr INT) ON COMMIT DROP;
 INSERT INTO idtellUued VALUES(1249228);
analyze idtelluued;
 explain analyze  select 1
   from dok JOIN rid USING(dokumnr)
 JOIN idtellUued USING(dokumnr)

"Nested Loop  (cost=0.00..275.18 rows=3 width=0) (actual time=87.266..87.388 
rows=8 loops=1)"
"  ->  Nested Loop  (cost=0.00..6.95 rows=1 width=8) (actual 
time=36.613..36.636 rows=1 loops=1)"
"        ->  Seq Scan on idtelluued  (cost=0.00..1.01 rows=1 width=4) 
(actual time=0.009..0.015 rows=1 loops=1)"
"        ->  Index Scan using dok_dokumnr_idx on dok  (cost=0.00..5.93 
rows=1 width=4) (actual time=36.585..36.590 rows=1 loops=1)"
"              Index Cond: (dok.dokumnr = "outer".dokumnr)"
"  ->  Index Scan using rid_dokumnr_idx on rid  (cost=0.00..267.23 rows=80 
width=4) (actual time=50.635..50.672 rows=8 loops=1)"
"        Index Cond: ("outer".dokumnr = rid.dokumnr)"
"Total runtime: 87.586 ms"




view thread (8+ messages)  latest in thread

Message-ID: <3D5FFE56C89B4D55956907DD7C712F42@andrusnotebook>
Permalink:  ../3D5FFE56C89B4D55956907DD7C712F42@andrusnotebook/
Also on:    postgresql.org/message-id/3D5FFE56C89B4D55956907DD7C712F42@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, stark@enterprisedb.com
  Subject: Re: seq scan over 3.3 million rows instead of single key index access
  In-Reply-To: <3D5FFE56C89B4D55956907DD7C712F42@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