From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Vivek Khera <khera(at)kcilink(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: [ADMIN] Q: Structured index - which one runs faster? |
Date: | 2003-05-23 17:38:37 |
Message-ID: | 17188.1053711517@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-admin pgsql-general pgsql-performance |
Vivek Khera <khera(at)kcilink(dot)com> writes:
> Are any of these indexes redundant:
> CREATE UNIQUE INDEX user_list_id_email ON user_list (owner_id,user_email);
> CREATE INDEX user_list_owner_id ON user_list (owner_id);
> CREATE INDEX user_list_oid_created ON user_list (owner_id,user_created);
> In particular, is user_list_owner_id redundant to
> user_list_oid_created?
Any of the three indexes can be used for a search on owner_id alone, so
yeah, user_list_owner_id is redundant. It would be marginally faster to
use user_list_owner_id for such a search, just because it's physically
smaller than the other two indexes, but against that you have to balance
the extra update cost of maintaining the additional index.
Also, I can imagine scenarios where even a pure SELECT query load could
find the extra index to be a net loss: if you have a mix of queries that
use two or all three indexes, and the indexes don't fit in kernel disk
cache but just one or two would, then you'll lose on extra I/O as the
indexes compete for cache space. Not sure how likely that scenario is,
but it's something to think about.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2003-05-23 17:49:33 | Re: upgrade issue |
Previous Message | Joe Conway | 2003-05-23 17:34:54 | Re: return multiple rows |
From | Date | Subject | |
---|---|---|---|
Next Message | Vivek Khera | 2003-05-23 18:04:28 | Re: [ADMIN] Q: Structured index - which one runs faster? |
Previous Message | scott.marlowe | 2003-05-23 16:55:34 | Re: caching query results |
From | Date | Subject | |
---|---|---|---|
Next Message | Vivek Khera | 2003-05-23 18:04:28 | Re: [ADMIN] Q: Structured index - which one runs faster? |
Previous Message | Bruno Wolff III | 2003-05-23 16:50:20 | Re: [ADMIN] Q: Structured index - which one runs faster? |