Re: Partial index and query plan

From: "Aleksandr Vinokurov" <aleksandr(dot)vin(at)gmail(dot)com>
To: "Scott Marlowe" <scott(dot)marlowe(at)gmail(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Partial index and query plan
Date: 2007-08-22 15:02:03
Message-ID: b048c51b0708220802u24d78e15i916bf7c52a303280@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Scott Marlowe wrote:
>
> I don't see the issue here. The index being used is the same partial
> index you created. Maybe it's just a question of semantics?
>

As I understand final filter is:
a) pointed at the index creation
b) is redundant as all the indexed records have action <> 0.

So checking of it is a time wasting.

And the plan should be this:

>> Limit (cost=0.00..3.05 rows=1 width=8) (actual time=4.798..4.798
>> rows=0 loops=1)
>> -> Index Scan using indx_date_action12_uid_user_his on
>> user_history (cost=0.00..6.10 rows=2 width=8) (actual
>> time=4.791..4.791 rows=0 loops=1)
>> Index Cond: ((date > '2007-08-18 14:33:40.60664'::timestamp
>> without time zone) AND (date <= '2007-08-18 16:30:00'::timestamp
>> without time zone) AND (uid = 138658))

I suggest that this 'Filter' check will not be noticed as it always
return TRUE, and so will be checked only once, -- because of the
"limit 1". :)

But thanks, Aleksandr.

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message George Pavlov 2007-08-22 15:39:28 minimum bounding circle for a triangle/polygon
Previous Message Scott Marlowe 2007-08-22 14:43:00 Re: Partial index and query plan