pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Aleksandr Vinokurov <aleksandr.vin@gmail.com>
To: Scott Marlowe <scott.marlowe@gmail.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Partial index and query plan
Date: Wed, 22 Aug 2007 19:02:03 +0400
Message-ID: <b048c51b0708220802u24d78e15i916bf7c52a303280@mail.gmail.com> (raw)
In-Reply-To: <dcc563d10708220743h37f85ae5scb183bb9e6e85073@mail.gmail.com>
References: <b048c51b0708220557g18cc9a6p7bf2ab195539c3bd@mail.gmail.com>
	<dcc563d10708220743h37f85ae5scb183bb9e6e85073@mail.gmail.com>

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.



view thread (5+ messages)

Message-ID: <b048c51b0708220802u24d78e15i916bf7c52a303280@mail.gmail.com>
Permalink:  ../b048c51b0708220802u24d78e15i916bf7c52a303280@mail.gmail.com/
Also on:    postgresql.org/message-id/b048c51b0708220802u24d78e15i916bf7c52a303280@mail.gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: aleksandr.vin@gmail.com, scott.marlowe@gmail.com
  Subject: Re: Partial index and query plan
  In-Reply-To: <b048c51b0708220802u24d78e15i916bf7c52a303280@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox