From: | Richard Huxton <dev(at)archonet(dot)com> |
---|---|
To: | Marcin Krol <mrkafk(at)gmail(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: The REAL cost of joins |
Date: | 2010-03-04 08:47:48 |
Message-ID: | 4B8F73B4.40600@archonet.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | Dave Page | 2010-03-04 08:49:00 | Re: Scratching my head why results are different between machines. |
Previous Message | John R Pierce | 2010-03-04 07:22:02 | Re: Need to Reload a Dump File - Need to Delete the PGDATA directory Again? |