pg.ddx.io pgsql-performance@postgresql.org mailing list archive
help / color / mirror / Atom feedBenchmark two separate SELECTs versus one LEFT JOIN
2+ messages / 2 participants
[nested] [flat]
* Benchmark two separate SELECTs versus one LEFT JOIN
@ 2005-01-06 02:31 Miles Keaton <mileskeaton@gmail.com>
0 siblings, 1 reply; 2+ messages in thread
From: Miles Keaton @ 2005-01-06 02:31 UTC (permalink / raw)
To: pgsql-performance
Has anyone seen a benchmark on the speed difference between:
SELECT * FROM item WHERE id=123;
and
SELECT * FROM vendor WHERE id=515;
versus:
SELECT * FROM item LEFT JOIN vendor ON item.vendor_id=vendor.id WHERE
item.id=123;
I only have a laptop here so I can't really benchmark properly.
I'm hoping maybe someone else has, or just knows which would be faster
under high traffic/quantity.
Thanks!
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: Benchmark two separate SELECTs versus one LEFT JOIN
@ 2005-01-06 16:57 Josh Berkus <josh@agliodbs.com>
parent: Miles Keaton <mileskeaton@gmail.com>
0 siblings, 0 replies; 2+ messages in thread
From: Josh Berkus @ 2005-01-06 16:57 UTC (permalink / raw)
To: pgsql-performance@postgresql.org, Miles Keaton <mileskeaton@gmail.com>
Miles,
> I only have a laptop here so I can't really benchmark properly.
> I'm hoping maybe someone else has, or just knows which would be faster
> under high traffic/quantity.
Well, it's really a difference between round-trip time vs. the time required
to compute the join. If your database is setup correctly, the 2nd should be
faster.
However, it should be very easy to test ....
--
Josh Berkus
Aglio Database Solutions
San Francisco
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2005-01-06 16:57 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-01-06 02:31 Benchmark two separate SELECTs versus one LEFT JOIN Miles Keaton <mileskeaton@gmail.com>
2005-01-06 16:57 ` Josh Berkus <josh@agliodbs.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox