Re: Index on integer or on string field

From: "FarjadFarid\(ChkNet\)" <farjad(dot)farid(at)checknetworks(dot)com>
To: "'Job'" <Job(at)colliniconsulting(dot)it>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: Index on integer or on string field
Date: 2015-05-16 12:32:25
Message-ID: 001401d08fd4$5dc6c210$19544630$@checknetworks.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

My approach would be to improve the uniqueness of each record/row. Otherwise
you'll have to traverse the entire table for every query. At 100/200 queries
per second you are asking for trouble on several fronts. Including crashing
your hard disk faster than need be.

Hope this helps. Good luck.

Best Regards

Farjad Farid

-----Original Message-----
From: pgsql-general-owner(at)postgresql(dot)org
[mailto:pgsql-general-owner(at)postgresql(dot)org] On Behalf Of Job
Sent: 15 May 2015 16:19
To: pgsql-general(at)postgresql(dot)org
Subject: [GENERAL] Index on integer or on string field

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?

Thank you!
Francesco

--
Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org) To make
changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Daniel Begin 2015-05-16 13:17:09 Re: Restarting DB after moving to another drive
Previous Message Bruce Momjian 2015-05-16 04:10:29 Re: pg_upgrade failing from 9.3 to 9.4 because "template0" already exists