Re: Query optimization using order by and limit - Mailing list pgsql-performance

From Tom Lane
Subject Re: Query optimization using order by and limit
Date
Msg-id 6768.1316657361@sss.pgh.pa.us
Whole thread Raw
In response to Re: Query optimization using order by and limit  (Greg Smith <greg@2ndQuadrant.com>)
Responses Re: Query optimization using order by and limit  (Michael Viscuso <michael.viscuso@getcarbonblack.com>)
List pgsql-performance
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

pgsql-performance by date:

Previous
From: Greg Smith
Date:
Subject: Re: Query optimization using order by and limit
Next
From: Michael Viscuso
Date:
Subject: Re: Query optimization using order by and limit