| From: | Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp> | 
|---|---|
| To: | robertmhaas(at)gmail(dot)com | 
| Cc: | tgl(at)sss(dot)pgh(dot)pa(dot)us, fujita(dot)etsuro(at)lab(dot)ntt(dot)co(dot)jp, pgsql-hackers(at)postgresql(dot)org | 
| Subject: | Re: Get more from indices. | 
| Date: | 2014-03-10 07:21:39 | 
| Message-ID: | 20140310.162139.201355356.horiguchi.kyotaro@lab.ntt.co.jp | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-hackers | 
Oops! I found a bug in this patch. The previous v8 patch missed
the case that build_index_pathkeys() could build a partial
pathkeys from the index tlist.
This causes the situation follows,
=======
=# \d cu11
     Table "public.cu11"
 Column |  Type   | Modifiers 
--------+---------+-----------
 a      | integer | not null
 b      | integer | not null
 c      | integer | 
 d      | text    | 
Indexes:
    "cu11_a_b_idx" UNIQUE, btree (a, b)
s=# explain (costs off) select * from cu11 order by a, c ,d;
              QUERY PLAN               
---------------------------------------
 Index Scan using cu11_a_b_idx on cu11
(1 row)
=======
Where the simple ORDER BY a, c, d on the table with index on
columns (a, b) results simple index scan which cannot perform the
order.
The attached v9 patche is fixed by adding a check for the case
into index_pathkeys_are_extensible(), and rebase to current HEAD.
regards,
-- 
Kyotaro Horiguchi
NTT Open Source Software Center
| Attachment | Content-Type | Size | 
|---|---|---|
| pathkey_and_uniqueindx_v9_20130310.patch | text/x-patch | 5.6 KB | 
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Haribabu Kommi | 2014-03-10 07:43:20 | Re: issue log message to suggest VACUUM FULL if a table is nearly empty | 
| Previous Message | Michael Paquier | 2014-03-10 06:45:18 | Re: calculating an aspect of shared buffer state from a background worker |