Re: Slow index scan on B-Tree index over timestamp field

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Nov 4, 2013 at 2:10 PM, Caio Casimiro <casimiro.listas@xxxxxxxxx> 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

[Postgresql General]     [Postgresql PHP]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Yosemite]

  Powered by Linux