Re: The REAL cost of joins

Поиск
Список
Период
Сортировка
От Richard Huxton
Тема Re: The REAL cost of joins
Дата
Msg-id 4B8F73B4.40600@archonet.com
обсуждение исходный текст
Ответ на The REAL cost of joins  (Marcin Krol <mrkafk@gmail.com>)
Ответы Re: The REAL cost of joins  (Grzegorz Jaśkiewicz <gryzman@gmail.com>)
Re: The REAL cost of joins  (Craig Ringer <craig@postnewspapers.com.au>)
Список pgsql-general
On 03/03/10 21:59, Marcin Krol wrote:
> What do you think of this? And in general: when (if?) should one
> denormalize data?

As a last resort. No sooner.

The support costs of denormalising your database is such that if you can
reasonably just buy more hardware / add caching / etc, do so.

Oh, and I'm afraid your tests are probably meaningless.
1. The times are too small to be accurate.
2. You have the overhead of starting psql and connecting to the
database, starting a new backend etc.
3. You have the overhead of parsing the query
4. You're fetching all rows (which presumably aren't many) - not a
terribly useful scenario.

If you wanted to measure actual join costs, you'd need to repeat the
tests (say) 100-1000 times in a loop, optionally with prepared plans.
Varying WHERE clauses might be useful too, if that's how your real
application will work.

--
   Richard Huxton
   Archonet Ltd

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

Предыдущее
От: John R Pierce
Дата:
Сообщение: Re: Need to Reload a Dump File - Need to Delete the PGDATA directory Again?
Следующее
От: Dave Page
Дата:
Сообщение: Re: Scratching my head why results are different between machines.