Skip site navigation (1) Skip section navigation (2)

Re: Query tuning

From: Nikolas Everett <nik9000(at)gmail(dot)com>
To: Grzegorz Jaśkiewicz <gryzman(at)gmail(dot)com>
Cc: Kevin Kempter <kevink(at)consistentstate(dot)com>, pgsql-performance(at)postgresql(dot)org
Subject: Re: Query tuning
Date: 2009-08-19 17:31:30
Message-ID: d4e11e980908191031q3871deadi2dbc3c6f70ffb688@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-performance
2009/8/19 Grzegorz Jaśkiewicz <gryzman(at)gmail(dot)com>

> that seems to be the killer:
>
> and time >= extract ('epoch' from timestamp '2009-08-12')
> and time < extract ('epoch' from timestamp '2009-08-13' )
>
> You probably need an index on time/epoch:
>
> CREATE INDEX foo ON table(extract ('epoch' from timestamp time );


It looks like those extracts just make constant integer times. You probably
just create an index on the time column.

Also, why not store times as timestamps?


>
>
> or something like that, vacuum analyze and retry.
>
> --
> Sent via pgsql-performance mailing list (pgsql-performance(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-performance
>

In response to

Responses

pgsql-performance by date

Next:From: Kevin KempterDate: 2009-08-19 17:36:55
Subject: Re: Query tuning
Previous:From: Scott CareyDate: 2009-08-19 17:17:26
Subject: Re: Query tuning

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group