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
--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general