pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Richard van den Berg <richard.vandenberg@trust-factory.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-perform <pgsql-performance@postgresql.org>
Subject: Re: When are index scans used over seq scans?
Date: Wed, 20 Apr 2005 17:54:45 +0200
Message-ID: <42667B45.5050101@trust-factory.com> (raw)
In-Reply-To: <26710.1114007961@sss.pgh.pa.us>
References: <426665A0.1080102@trust-factory.com>
	<26710.1114007961@sss.pgh.pa.us>

Tom Lane wrote:
> The explain shows no such thing.  What is the *actual* runtime of
> each plan per EXPLAIN ANALYZE, please?

I took a simplified version of the problem (the actual query that took 6
hours joins 3 tables). With cpu_tuple_cost = 0.1:

 Nested Loop  (cost=0.00..667700310.42 rows=1035480320 width=97) (actual
time=31.468..42629.629 rows=6171334 loops=1)
   ->  Seq Scan on sessions us  (cost=0.00..125756.60 rows=924536
width=105) (actual time=31.366..3293.523 rows=924536 loops=1)
   ->  Index Scan using ix_du_ts on duration du  (cost=0.00..604.46
rows=1120 width=8) (actual time=0.004..0.011 rows=7 loops=924536)
         Index Cond: (("outer".starttimetrunc <= du.ts) AND
("outer".finishtimetrunc >= du.ts))
 Total runtime: 44337.937 ms

The explain analyze for cpu_tuple_cost = 0.01 is running now. If it
takes hours, I'll send it to the list tomorrow.

-- 
Richard van den Berg, CISSP
-------------------------------------------
Trust Factory B.V. |     www.dna-portal.net
Bazarstraat 44a    |  www.trust-factory.com
2518AK The Hague   |  Phone: +31 70 3620684
The Netherlands    |  Fax  : +31 70 3603009
-------------------------------------------



view thread (13+ messages)  latest in thread

Message-ID: <42667B45.5050101@trust-factory.com>
Permalink:  ../42667B45.5050101@trust-factory.com/
Also on:    postgresql.org/message-id/42667B45.5050101@trust-factory.com

 · 

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: richard.vandenberg@trust-factory.com, tgl@sss.pgh.pa.us
  Subject: Re: When are index scans used over seq scans?
  In-Reply-To: <42667B45.5050101@trust-factory.com>

* 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