Question about explain of index scan

From: Hannu Krosing <hannu(at)skype(dot)net>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Question about explain of index scan
Date: 2005-09-02 06:36:26
Message-ID: 1125642986.5013.39.camel@fuji.krosing.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

How does Index scan perform a scan for overlapping Index Cond ?

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'))
)

(this is from a query generated by Slony for 4 sets replicated from the
same master)

Will the same range be scanned 4 times ?

Or is the scan method smart enough to collapse them into one pass ?

Or does this actually mean 4 conactenated index scans (Index Scan using
X, X, X, X on sl_log_1) ?

--
Hannu Krosing <hannu(at)skype(dot)net>

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Koichi Suzuki 2005-09-02 10:36:42 Re: A couple of patches for PostgreSQL 64bit support
Previous Message ITAGAKI Takahiro 2005-09-02 05:40:37 Re: Two different defs of MAX_TUPLES_PER_PAGE