Re: When are index scans used over seq scans?

From: Richard van den Berg <richard(dot)vandenberg(at)trust-factory(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-perform <pgsql-performance(at)postgresql(dot)org>
Subject: Re: When are index scans used over seq scans?
Date: 2005-04-20 15:54:45
Message-ID: 42667B45.5050101@trust-factory.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

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

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Christian Sander Røsnes 2005-04-20 16:14:12 Re: Opteron vs Xeon (Was: What to do with 6 disks?)
Previous Message Bruce Momjian 2005-04-20 15:50:26 Re: Opteron vs Xeon (Was: What to do with 6 disks?)