Re: index on id and created_at

From: "Scott Marlowe" <scott(dot)marlowe(at)gmail(dot)com>
To: "Marcus Engene" <mengpg2(at)engene(dot)se>
Cc: POSTGRESQL <pgsql-general(at)postgresql(dot)org>
Subject: Re: index on id and created_at
Date: 2008-09-11 18:58:42
Message-ID: dcc563d10809111158u5185ba1bo4d84d086b99bc389@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Sep 11, 2008 at 10:08 AM, Marcus Engene <mengpg2(at)engene(dot)se> wrote:
> select
> objectid
> from
> apa
> where
> created_at > now() - interval '1 day'
> order by
> objectid desc;
>
> In this select, it would have been nice to dodge the full table scan without
> adding an index to created_at. Is this possible somehow?

Not really. It's a choice of one or the other.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Scott Marlowe 2008-09-11 19:02:56 Re: connection timeouts and "killing" users
Previous Message Scott Marlowe 2008-09-11 18:55:16 Re: "Healing" a table after massive updates