Which design would be faster ... - Mailing list pgsql-general

From Haim Ashkenazi
Subject Which design would be faster ...
Date
Msg-id 44bd12520807160740t2f9ef4eam4e826473e2d8a21@mail.gmail.com
Whole thread Raw
Responses Re: Which design would be faster ...
List 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

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: unable to drop a constraint
Next
From: Viktor Rosenfeld
Date:
Subject: Re: UPDATE runs slow in a transaction