Re: Inefficient query plan

Поиск
Список
Период
Сортировка
От Kevin Grittner
Тема Re: Inefficient query plan
Дата
Msg-id 4C72475F0200002500034A62@gw.wicourts.gov
обсуждение исходный текст
Ответ на Re: Inefficient query plan  (Grzegorz Jaśkiewicz <gryzman@gmail.com>)
Список pgsql-performance
Grzegorz Jaœkiewicz<gryzman@gmail.com> wrote:

> So, don't narrow down to one solution because it worked for you.
> Keep an open book.

What I was trying to do was advise on what would most directly fix
the problem.  Adding surrogate keys goes way beyond adding the
columns and using them as keys, as I'm sure you're aware if you've
done this on a large scale.  I wouldn't tell someone not to ever use
them; I would advise not to try them when there is a natural key
unless there are problems which are not solved without them, as
appears to have been the case with your database.

I may be a little bit over-sensitive on the topic, because I've seen
so many people who consider it "wrong" to use natural keys on any
table *ever*.  About one out of every four or five programmers who
gets hired here feels compelled to argue that we should add
surrogate keys to all our tables for no reason beyond "it's the
thing to do".  I've been at this for 38 years, most of that as a
consultant to a wide variety of businesses, government agencies, and
NPOs; and in my experience it usually is *not* the right thing to
do.

Don't worry -- when I see evidence that surrogate keys will solve a
problem which has not yielded to more conservative solutions, I'll
suggest using them.

-Kevin

В списке pgsql-performance по дате отправления:

Предыдущее
От: Grzegorz Jaśkiewicz
Дата:
Сообщение: Re: Inefficient query plan
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Inefficient query plan