php - How to optimize this mySQL query in terms of performance? -


how can optimize follow query ?

select hash,page,timestamp, count(*) total behaviour group hash, page having total > 2 , timestamp >= now() - interval 5 minute 

thank you

this query it's not wrong. maybe bigger volume, have problem performance. try use "where conditions" always. (in context, don't know if possible). tip, explain on query! use "explain" before query. (explain select hash, timestamp, count(*)........). in way, can discover how many results query returned.


Comments

Popular posts from this blog

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -

asp.net mvc - breakpoint on javascript in CSHTML? -