From: | Jeff Janes <jeff(dot)janes(at)gmail(dot)com> |
---|---|
To: | Caio Casimiro <casimiro(dot)listas(at)gmail(dot)com> |
Cc: | Elliot <yields(dot)falsehood(at)gmail(dot)com>, Igor Neyman <ineyman(at)perceptron(dot)com>, "pgsql-performance(at)postgresql(dot)org" <pgsql-performance(at)postgresql(dot)org> |
Subject: | Re: Slow index scan on B-Tree index over timestamp field |
Date: | 2013-11-05 16:10:19 |
Message-ID: | CAMkU=1yAyZMCPnBUZ6N_RLreWhys=owfLSuax41vf2_4aPQnbA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-performance |
On Mon, Nov 4, 2013 at 2:10 PM, Caio Casimiro <casimiro(dot)listas(at)gmail(dot)com>wrote:
>
> You said that I would need B-Tree indexes on the fields that I want the
> planner to use index only scan, and I think I have them already on the
> tweet table:
>
> "tweet_ios_index" btree (id, user_id, creation_time)
>
> Shouldn't the tweet_ios_index be enough to make the scan over
> tweet_creation_time_index be a index only scan?
>
You can't efficiently scan an index when the first column in it is not
constrained. You would have to define the index as (creation_time,
user_id, id) instead to get it to use an IOS.
> And, more important, would it be really faster?
>
Probably.
Cheers,
Jeff
From | Date | Subject | |
---|---|---|---|
Next Message | Merlin Moncure | 2013-11-05 17:30:27 | Re: Trees: integer[] outperformed by ltree |
Previous Message | Igor Neyman | 2013-11-05 13:17:59 | Re: Slow index scan on B-Tree index over timestamp field |