Why do we allow indexes to contain the same column more than once?

From: Greg Stark <stark(at)mit(dot)edu>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Why do we allow indexes to contain the same column more than once?
Date: 2014-05-01 12:55:46
Message-ID: CAM-w4HPTWCm9o=PnadguOPd_hiqcW-ruEJQs+2CMOBKbbAaRbg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Is there some use case for that I'm not seeing?

postgres=***# create index tti on
tt(i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i);
CREATE INDEX
Time: 15.891 ms

postgres=***# commit;
COMMIT
Time: 11.191 ms

postgres=# \d tt
Table "public.tt"
+--------+---------+-----------+
| Column | Type | Modifiers |
+--------+---------+-----------+
| i | integer | |
+--------+---------+-----------+
Indexes:
"tti" btree (i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i,
i, i, i, i, i, i, i, i, i, i, i, i, i, i)

postgres=# \d tti
Index "public.tti"
+--------+---------+------------+
| Column | Type | Definition |
+--------+---------+------------+
| i | integer | i |
| i1 | integer | i |
| i2 | integer | i |
| i3 | integer | i |
| i4 | integer | i |
| i5 | integer | i |
| i6 | integer | i |
| i7 | integer | i |
| i8 | integer | i |
| i9 | integer | i |
| i10 | integer | i |
| i11 | integer | i |
| i12 | integer | i |
| i13 | integer | i |
| i14 | integer | i |
| i15 | integer | i |
| i16 | integer | i |
| i17 | integer | i |
| i18 | integer | i |
| i19 | integer | i |
| i20 | integer | i |
| i21 | integer | i |
| i22 | integer | i |
| i23 | integer | i |
| i24 | integer | i |
| i25 | integer | i |
| i26 | integer | i |
| i27 | integer | i |
| i28 | integer | i |
| i29 | integer | i |
| i30 | integer | i |
| i31 | integer | i |
+--------+---------+------------+
btree, for table "public.tt"

--
greg

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2014-05-01 13:11:31 Re: Why do we allow indexes to contain the same column more than once?
Previous Message Filip Rembiałkowski 2014-05-01 05:30:12 improving \dt++ in psql