Re: Postgresql selecting strange index for simple query

From: Maxim Boguk <mboguk(at)masterhost(dot)ru>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Postgresql selecting strange index for simple query
Date: 2009-02-26 16:18:26
Message-ID: 49A6C0D2.8050906@masterhost.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Tom Lane wrote:
> Maxim Boguk <mboguk(at)masterhost(dot)ru> writes:
>> Somehow postgres think index scan on singlecolumn index slower comparing to scan on 4th field of 4column index.
>
> It does know better than that. I'm wondering if the single-column index
> has become very bloated or something. Have you compared the physical
> index sizes?

Table fresh loaded from dump on test server... So no index bloat for sure...
As for comparing physical sizes, right single column index indeed smaller then wrong one:

Right index:
hh=# SELECT pg_size_pretty(pg_relation_size('resume_last_change_time_idx'));
pg_size_pretty
----------------
125 MB
(1 row)

Wrong index:
hh=# SELECT pg_size_pretty(pg_relation_size('resume_user_id_disabled_is_finished_last_change_time_idx'));
pg_size_pretty
----------------
226 MB
(1 row)

Regards, Maxim Boguk

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Andrew Gould 2009-02-26 16:22:58 Re: Off Topic: ICD-10 codes in a database table?
Previous Message Tom Lane 2009-02-26 16:11:26 Re: Postgresql selecting strange index for simple query