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: Thu, 21 Apr 2005 10:15:40 +0200
Message-ID: <4267612C.10803@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?
Ok, it took 3.5 hours to complete. :-/
This is with the default cpu_tuple_cost = 0.01:
Nested Loop (cost=252.80..233010147.16 rows=1035480320 width=98)
(actual time=0.369..12672213.137 rows=6171334 loops=1)
Join Filter: (("outer".starttimetrunc <= "inner".ts) AND
("outer".finishtimetrunc >= "inner".ts))
-> Seq Scan on sessions us (cost=0.00..26822.36 rows=924536
width=106) (actual time=0.039..5447.349 rows=924536 loops=1)
-> Materialize (cost=252.80..353.60 rows=10080 width=8) (actual
time=0.000..2.770 rows=10080 loops=924536)
-> Seq Scan on duration du (cost=0.00..252.80 rows=10080
width=8) (actual time=0.019..13.397 rows=10080 loops=1)
Total runtime: 12674486.670 ms
Once again with cpu_tuple_cost = 0.1:
Nested Loop (cost=0.00..667684584.42 rows=1035480320 width=98) (actual
time=42.892..39877.928 rows=6171334 loops=1)
-> Seq Scan on sessions us (cost=0.00..110030.60 rows=924536
width=106) (actual time=0.020..917.803 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: 41635.468 ms
(5 rows)
--
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
-------------------------------------------
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: <4267612C.10803@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