pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Greg Smith <greg@2ndQuadrant.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Query optimization using order by and limit
Date: Wed, 21 Sep 2011 22:09:21 -0400
Message-ID: <6768.1316657361@sss.pgh.pa.us> (raw)
In-Reply-To: <4E7A93F9.1050301@2ndQuadrant.com>
References: <CA+Z27QQDRQ1h_tD1Tm_+T+-cBdt00hLWYRnvXygxLf_JWNTxZQ@mail.gmail.com>
	<4E7A93F9.1050301@2ndQuadrant.com>

Greg Smith <greg@2ndQuadrant.com> writes:
> That weird casting can't be helping.  I'm not sure if it's your problem 
> here, but the constraint exclusion code is pretty picky about matching 
> the thing you're looking for against the CHECK constraint, and this is a 
> messy one.  The bigint conversion in the middle there isn't doing 
> anything useful for you anyway; you really should simplify this to just 
> look like this:
> firstloadtime >= 129604464000000000::numeric

I have a more aggressive suggestion: change all the numeric(20,0) fields
to bigint.  Unless the OP actually needs values wider than 64 bits,
the choice to use numeric is a significant performance penalty for
nothing.

			regards, tom lane



view thread (14+ messages)  latest in thread

Message-ID: <6768.1316657361@sss.pgh.pa.us>
Permalink:  ../6768.1316657361@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/6768.1316657361@sss.pgh.pa.us

 · 

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: tgl@sss.pgh.pa.us, greg@2ndQuadrant.com
  Subject: Re: Query optimization using order by and limit
  In-Reply-To: <6768.1316657361@sss.pgh.pa.us>

* 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