MySQL Forums
Forum List  »  Optimizer & Parser

Query performance on indexed columns
Posted by: marco rossi
Date: April 24, 2007 06:52AM

I've got a question regarding the performance of queries on indexed columns.

I've got a query like this
SELECT SUM (value) FROM table WHERE id=x
id is an index for the table 'table'
In order to excute this query, I think the Db only examines the rows for wich the query WHERE condition is true, without reading all the rows in the table. Am I right?

So, if I got an INNO_DB table with say 50000 records with articles identified by IDs, and say that every article is repeated in the table a maximum of 5 times, issuing a SELECT SUM query on the indexed ID field, will not impact on overall performance cause only a maximum of 5 rows will be examined.
In such a situation, I can say that the SELECT SUM performance is quite similar to the performance af a simple SELECT query, isn't it?

Options: ReplyQuote


Subject
Views
Written By
Posted
Query performance on indexed columns
2756
April 24, 2007 06:52AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.