Re: Query optimization using order by and limit

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Greg Smith <greg(at)2ndQuadrant(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Query optimization using order by and limit
Date: 2011-09-22 02:09:21
Message-ID: 6768.1316657361@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Greg Smith <greg(at)2ndQuadrant(dot)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

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Michael Viscuso 2011-09-22 02:55:21 Re: Query optimization using order by and limit
Previous Message Greg Smith 2011-09-22 01:48:41 Re: Query optimization using order by and limit