From: Tom Lane <tgl@sss.pgh.pa.us>
To: Steve Lane <slane@moyergroup.com>
Cc: pgsql-admin@postgresql.org
Subject: Re: Index (re)-creation speed
Date: Fri, 06 Feb 2004 01:30:15 -0500
Message-ID: <24649.1076049015@sss.pgh.pa.us> (raw)
In-Reply-To: <BC487604.9873%slane@moyergroup.com>
References: <BC487604.9873%slane@moyergroup.com>
Steve Lane <slane@moyergroup.com> writes:
> When I drop and rebuild the indexes, they take oddly varying amounts of time
> to rebuild. I rebuilt them in the following order, with the following rough
> times. I took a guess that the speed of the rebuild might be related to the
> number of distinct values in the column -- this seems true in some cases but
> not in others. Here are the times:
> id_response 38 secs (86000 distinct)
> id_topic 33 secs (6 distinct)
> id_survey 13 secs (1 distinct)
> id_code 39 secs (1444 distinct)
> id_item 40 secs (65 distinct)
> id_administration 13 secs (1 distinct)
How many rows altogether in this table? What sort_mem are you using
(and have you tried altering it)?
When I read your previous message I was wondering about different
datatypes having different comparison costs, but since these are all
integer columns that's clearly not the issue here. I think you may
be seeing something related to the number of initial runs created in the
sorting algorithm --- with only one distinct value, there'd always be
just one run and no need for any merge passes.
(Why are you bothering to index columns with only one or a few values in
them, anyway? Such an index will be useless for searches ...)
regards, tom lane
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-admin@postgresql.org
Cc: tgl@sss.pgh.pa.us, slane@moyergroup.com
Subject: Re: Index (re)-creation speed
In-Reply-To: <24649.1076049015@sss.pgh.pa.us>
References: <BC487604.9873%slane@moyergroup.com> <24649.1076049015@sss.pgh.pa.us>
* 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