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: Thu, 21 Apr 2005 18:16:45 +0200
Message-ID: <4267D1ED.7010606@trust-factory.com> (raw)
In-Reply-To: <15074.1114093502@sss.pgh.pa.us>
References: <426665A0.1080102@trust-factory.com>
	<26710.1114007961@sss.pgh.pa.us>
	<4267612C.10803@trust-factory.com>
	<15074.1114093502@sss.pgh.pa.us>

Tom Lane wrote:
> which is almost 80% of the entire runtime.  Which is enormous.
> What are those column datatypes exactly? 

                      Table "richard.sessions"
         Column         |            Type             | Modifiers
------------------------+-----------------------------+-----------
[unrelated columns removed]
 starttimetrunc         | timestamp without time zone |
 finishtimetrunc        | timestamp without time zone |
Indexes:
    "rb_us_st_ft_idx" btree (starttimetrunc, finishtimetrunc)
    "rb_us_st_ft_idx2" btree (finishtimetrunc, starttimetrunc)
Check constraints:
    "date_check" CHECK (finishtimetrunc >= starttimetrunc)

             Table "richard.duration"
 Column |            Type             | Modifiers
--------+-----------------------------+-----------
 ts     | timestamp without time zone |

> Perhaps you are incurring a datatype conversion cost? 

Not that I can tell.

> It seems more likely that the cpu_operator_cost is underestimated,

As you perdicted, increasing cpu_operator_cost from 0.0025 to 0.025 also
causes the planner to use the index on duration.

> which leads me to question what exactly is happening in those
> comparisons.

Your guess is as good as mine (actually, yours is much better). I can
put together a reproducable test case if you like..

-- 
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
-------------------------------------------
   Have you visited our new DNA Portal?
-------------------------------------------



view thread (13+ messages)  latest in thread

Message-ID: <4267D1ED.7010606@trust-factory.com>
Permalink:  ../4267D1ED.7010606@trust-factory.com/
Also on:    postgresql.org/message-id/4267D1ED.7010606@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: <4267D1ED.7010606@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