Re: optimisation for a table with frequently used query

From: Lew <lew(at)nospam(dot)lewscanon(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: optimisation for a table with frequently used query
Date: 2007-05-29 13:38:09
Message-ID: SeudncuAW8ZfscHbnZ2dnUVZ_ualnZ2d@comcast.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

danmcb wrote:
>> SELECT * from my_table where id_1 = x and id_2 = y;
>> Neither id_1 or id_2 or the combination of them is unique. I expect
>> this table to become large over time.

PFC wrote:
> Create an index on (id_1, id_2), or (id_2,id_1).

What are the strengths and weaknesses compared to creating two indexes, one on
each column?

I am guessing that changes to the table are slower with two indexes. How
could it affect queries?

What if the typical query pattern was more balanced among constraints on one
column, on the other, and on both?

--
Lew

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Merlin Moncure 2007-05-29 13:39:04 Re: hundreds of schema vs hundreds of databases
Previous Message Michael Glaesemann 2007-05-29 13:35:51 Re: [HACKERS] Users specific to a Database