From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Hannu Krosing <hannu(at)skype(dot)net> |
Cc: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Question about explain of index scan |
Date: | 2005-09-02 14:31:45 |
Message-ID: | 13995.1125671505@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hannu Krosing <hannu(at)skype(dot)net> writes:
> If I get a plan like this, what will actually be performed if EXPLAIN
> shows this:
> Sort (cost=12.90..12.91 rows=1 width=207)
> Sort Key: log_actionseq
> -> Index Scan using sl_log_1_idx2_hu, sl_log_1_idx2_hu,
> sl_log_1_idx2_hu, sl_log_1_idx2_hu on sl_log_1 (cost=0.00..12.89 rows=1
> width=207)
> Index Cond: (
> ((log_xid < '1349053093') AND (log_xid >= '1349052761'))
> OR ((log_xid < '1349053093') AND (log_xid >= '1349052761'))
> OR ((log_xid < '1349053093') AND (log_xid >= '1349052761'))
> OR ((log_xid < '1349053093') AND (log_xid >= '1349052761'))
> )
> Will the same range be scanned 4 times ?
Yes. However, I don't understand how you got that result; AFAIK the
planner should have eliminated the duplicate subclauses. For example,
in 8.0 I get
regression=# explain select * from tenk1 where unique1 between 1 and 100 or unique1 between 1 and 100 or unique1 between 1 and 100;
QUERY PLAN
---------------------------------------------------------------------------------
Index Scan using tenk1_unique1 on tenk1 (cost=0.00..360.63 rows=102 width=244)
Index Cond: ((unique1 >= 1) AND (unique1 <= 100))
(2 rows)
Is Slony doing something to bypass the planner?
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Matt Miller | 2005-09-02 14:34:50 | Re: PL/pgSQL: EXCEPTION NOSAVEPOINT |
Previous Message | Merlin Moncure | 2005-09-02 14:02:36 | Re: Call for 7.5 feature completion |