Search Postgresql Archives

Running queries to fetch a count of hits in DB on several things

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi, this is basically what I would like to improve : 

1) A user searches for a product on category and location. 

a) The query is run and the result (limit 30) are returned and shown.
b) The same query is ran again but now I return the count on how many matches there was totally. (This has to be possible to include somehow in the above, without the limit it would return all rows and therefor the number of matches as well)
c) The same query is ran again but now I return the count on how many matches there was in each location
c)  --- " " --- count on category.
d) --- " " ---  count on how many that was used or new. 
etc...


How can I improve this? Seems so unnecessary to have to run the query on every count I want to do when its the same query hitting the same relation with a slight modification in each? Is there a way or should I just forget about it and run them over and over again? I am guessing using functions could be possible but now so little about them and how to run them from Java. There might be 1000 or more users on the website simultaneously and I am guessing this could be a real downside...

Thanks / Moe






























[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux