Re: When are index scans used over seq scans? - Mailing list pgsql-performance

From Richard van den Berg
Subject Re: When are index scans used over seq scans?
Date
Msg-id 42667B45.5050101@trust-factory.com
Whole thread Raw
In response to Re: When are index scans used over seq scans?  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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
-------------------------------------------

pgsql-performance by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Opteron vs Xeon (Was: What to do with 6 disks?)
Next
From: Christian Sander Røsnes
Date:
Subject: Re: Opteron vs Xeon (Was: What to do with 6 disks?)