Re: Shall I apply normalization in the following case?

From: Lew <noone(at)lwsc(dot)ehost-services(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Shall I apply normalization in the following case?
Date: 2010-02-04 15:12:39
Message-ID: hkeo58$v71$1@news.albasani.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Sim Zacks wrote:
> 2) querying on an int is quicker then querying on a string, so if you
> query on the values without the join you will have better performance.

The point of Jorge's approach is that it allows a query without a join.

With the OP's normalization, using integer keys, a join was required,
obviating any advantage to the integer key.

The assertion that a query involving integer keys is always faster than one
with string keys is unsafe at best. The first rule of performance
optimization is that optimizations don't.

You have to test and measure to find out when and if they do.

Misuse of surrogate keys to obtain optimization is a prime example. I've seen
situations in the field several times when such abuse forces extra joins in
queries and an increase in the number of indexes to maintain. Without
measurement under representative workloads, especially concurrent activity,
it's impossible to know whether the cost outweighs the benefit.

--
Lew

In response to

Browse pgsql-general by date

  From Date Subject
Next Message A. Kretschmer 2010-02-04 15:18:12 Re: Postgres wal shipping from 8.33 to 8.42.
Previous Message Tom Lane 2010-02-04 15:00:39 Re: Literals in foreign key definitions