From: Chris Hoover <revoohc@gmail.com>
To: PGSQL Performance <pgsql-performance@postgresql.org>
Subject: Which index methodology is better?-
Date: Mon, 5 Nov 2007 13:43:07 -0500
Message-ID: <1d219a6f0711051043x569b7f51r4cee3353e6ea9f10@mail.gmail.com> (raw)
I have a question.
Consider this scenario.
Table customer (
customer_id int8,
customer_l_name varchar(35),
customer_f_name varchar(30),
customer_addr_1 varchar(100),\
customer_addr_2 varchar(100),
customer_city varchar(50),
customer_state char(2),
customer_zip varchar(9)
);
On this table, a customer can search by customer_id, customer_l_name,
and customer_f_name.
Is it better to create 3 indexes, or one index on the three columns?
I did some initial testing with index customer_test_idx(customer_id,
customer_l_name, customer_f_name) and postgres would use the index for
select * from customer where customer_f_name = 'zxy' - so the single
index will cover the three.
My question is, is this better? Does it end up using less memory
and/or disk or more? I am trying to find ways to keep more of my
customers databases in memory, and I am thinking that loading one
index is probably a little better than loading three.
Thanks for any advice,
Chris
PG 8.1
RH 4.0
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-performance@postgresql.org
Cc: revoohc@gmail.com
Subject: Re: Which index methodology is better?-
In-Reply-To: <1d219a6f0711051043x569b7f51r4cee3353e6ea9f10@mail.gmail.com>
References: <1d219a6f0711051043x569b7f51r4cee3353e6ea9f10@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox