Re: Performance - WAS: Problem with count(*) in db query
| From: | Norbert Mocsnik | Date: | Mon, 08 Nov 2004 11:19:31 +0000 |
| Subject: | Re: Performance - WAS: Problem with count(*) in db query | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-15383@lists.php.net to get a copy of this message | ||
George Pitcher wrote:
My test searches a 3,100+ record table, grabs university-level data (university courses) then does 7 queries on a 32,000+ record transaction table to produce some stats. Then, while displaying each row in a table, does 5 queries on related records in the transaction table.This an application design / SQL level question. Isn't it possible to join those queries? What does your "main" query do? Gets id's of those records that you want to display? If your DBMS supports subselects, use them. If your DBMS supports stored procedures or views, use them if possible.
Everything in my tables is indexed. Make sure your DBMS really uses those indices.(explain select ..)
Any tips on how to improve performance? Try to find some other ways to get those results (combine SELECTs, ifpossible). -- Regards, Norbert Mocsnik http://norbert.mocsnik.hu/