Which design would be faster ...

From: "Haim Ashkenazi" <haim(dot)ashkenazi(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Which design would be faster ...
Date: 2008-07-16 14:40:50
Message-ID: 44bd12520807160740t2f9ef4eam4e826473e2d8a21@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi

I'm creating an application that have an fixed length alphanumeric key
and each key has (currently) up to 5 fixed length alphanumeric
variables. I was wondering which of the designs would be faster
considering that I could have about million keys...

The first design is the obvious one. create one table with ID and
"KEYNAME", and a second table which uses the ID of the first table as
foreign key to list values.

The second design is to use one table with the columns: "key",
"value1", "value2", etc...
Since it's highly unlikely that we'll ever change the number of
values, I'm ready to consider this option if it proves to be much
faster then the first design. (although I do prefer the first design
if the speed improvements is minor).

Any ideas?

Thanks in advance
--
Haim

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Viktor Rosenfeld 2008-07-16 14:42:35 Re: UPDATE runs slow in a transaction
Previous Message Tom Lane 2008-07-16 14:40:16 Re: unable to drop a constraint