MySQL Forums
Forum List  »  Optimizer & Parser

Dynamic Queries Optimization
Posted by: Irfan Ali
Date: November 15, 2010 01:51PM

In my app i saw many queries fetches information with different criteria (changing in WHERE clause) and changes in GROUP BY or ORDER BY clause.

How to optimize those queries ?
Should i use different strategy. SP or Prepared statements ? What is the best alternative for those dynamic queries if it's impossible to tune dynamic queries.

SELECT * FROM table WHERE id=1 GROUP BY id ORDER BY date DESC;
SELECT * FROM table WHERE username='abc' ORDER BY id;
SELECT count(userid) FROM table WHERE email='abc@example.com' GROUP BY userid ORDER BY id DESC;

Options: ReplyQuote


Subject
Views
Written By
Posted
Dynamic Queries Optimization
2521
November 15, 2010 01:51PM
1474
November 18, 2010 12:46AM


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.