Re: sql optimizing assistance
| From: | CPT John W. Holmes | Date: | Fri, 19 Sep 2003 19:59:27 +0000 |
| Subject: | Re: sql optimizing assistance | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-30582@lists.php.net to get a copy of this message | ||
From: <jeffrey_n_Dyke@Keane.com>
> I have two tables and am running a simple join between them to get
> questions and their repsective response averages from a survey. The
> question table has 49 rows and the Response table has 126,732. I'd like
to
> cut down on the time its taking to run this specific query...as i'll be
> running many like it to generate reports. The query below is the selecting
> the most data, normally this will be limited to specific groups by joining
> more tables.
>
> I am executing the following query
> SELECT Question.Text_Long, AVG( Response ) FROM
Response INNER
> JOIN
> Question ON Question.Question_Key = Response.Question_Key WHERE
> Question.Question_Key LIKE '2003%' GROUP BY Response.Question_Key ORDER BY
> Question.Question_Key ASC
What does EXPLAIN tell you for this query? Is it using your indexes?
---John Holmes...