335 times faster (!) - Mailing list pgsql-general

From Mikael Carneholm
Subject 335 times faster (!)
Date
Msg-id 1044294151024806@lycos-europe.com
Whole thread Raw
Responses Re: 335 times faster (!)
Re: 335 times faster (!)
Re: 335 times faster (!)
List pgsql-general
I discovered a strange thing when doing a simple search on a (comparably) large table with ~900K rows today:

When searching for a specific row on the primary key (type: bigint), the search took about 6,5 seconds. The column has
adefault btree index as created by the primary key constraint. However, when searching for the same row on one of it's
columns(type: text) which has a functional index on lower(column name), the same row was retrieved in 19ms! That's ~335
timesfaster! 

My idea is thus that one could create tables with a text type column holding the value of the identifier without using
the'primary key' clause, and then afterwards add a functional index on lower(column name). If performance is the main
issue,this must be an interesting solution. The downside is of course that the text data type may result in invalid
integervalues being inserted as keys. 

Anyone tried this before?

- Mikael

_____________________________________________________________
Här börjar internet!
Skaffa gratis e-mail och gratis internet på http://www.spray.se

Träffa folk från hela Sverige på ett och samma ställe - http://chat.spray.se/



pgsql-general by date:

Previous
From: "Vilson farias"
Date:
Subject: Drop constraint in PostgreSQL 7.1.2
Next
From: Arjen van der Meijden
Date:
Subject: Re: Printer setup