Re: Index on integer or on string field

From: Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com>
To: Job <Job(at)colliniconsulting(dot)it>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Index on integer or on string field
Date: 2015-05-16 00:31:01
Message-ID: CAOR=d=0bvy4a3EGMk1Ogd533rO2CTrN510fbrsaEdP3P+S=M4w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, May 15, 2015 at 9:18 AM, Job <Job(at)colliniconsulting(dot)it> wrote:
> Hello,
>
> i have a table of about 10 millions of records, with the index on a string field.
> Actually is alphabetical; since queries are about 100/200 per seconds, i was looking for a better way to improve performance and reduce workload.
>
> The unique values, of that fields, are about the 50 (category name), and we could create a second table to codify, with numerical integer values, the 50 recurring names.
>
> Is index are integer and not characteral, performance are better and workload reduces?
>
> Is there any comparisons?

Have you considered using a multi-column index here? if there's a more
selective field you could index along with your rather non-selective
one that might work better. But it's hard to tell without looking at
you database usage etc.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Bruce Momjian 2015-05-16 04:10:29 Re: pg_upgrade failing from 9.3 to 9.4 because "template0" already exists
Previous Message William Dunn 2015-05-15 23:36:52 Re: R: Index on integer or on string field