Thanks for the feedback, everyone. > > FROM tasks > > LEFT JOIN clients ON tasks.ClientId = clients.ClientId > > LEFT JOIN iteminfo ON tasks.Id = iteminfo.ItemId > > LEFT JOIN changelog ON tasks.Id = changelog.ItemId > > LEFT JOIN ticklers ON tasks.Id = ticklers.RelatedId > > WHERE tasks.Id = '123456'; > > > > (I've cleaned it up so it's easier to read.) > > Thanks Ryan - that always makes it easier.
It actually looked so much less crazy after the cleaning that I nearly decided not to ask about it, but my I was really interested in learning if there was a dramatically better approach. Looks like there probably isn't, which is fine. > For the case when you have large numbers of results from iteminfo etc. > it might well be quicker to do separate queries. That's simple enough > since you're joining straight to tasks.id, but is obviously more fiddly > and when there aren't many rows returned would probably be slower (you'd > have 5 lots of query parsing/execute overhead). That might be a > trade-off that makes sense to you though. Even though the tables are fairly big, the result-set should be small (a few dozen maybe), so multiple queries probably wouldn't gain much. Thanks again! Ryan -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql