View Single Post

   
  #1 (permalink)  
Old 04-17-2008, 09:44 PM
Leif K-Brooks
 
Posts: n/a
Default Performance of multiple queries?

I'm wondering about the performance of using one query versus several.
For instance, how much slower would several queries be:

SELECT name FROM table WHERE id=123;
SELECT value FROM table WHERE id=123;
SELECT type FROM table WHERE id=123;

As compared to one larger equivalent query:

SELECT name, value, type FROM table WHERE id=123;

It would be immensely easier for my application to use multiple small
queries so that it wouldn't need to worry about invalidating a cache
after a period of time, but if the performance hit would be too large,
I suppose I'll bite the bullet and write the annoying caching code.

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq

Reply With Quote