Posts: 428
Threads: 0
Joined: Jan 2015
Reputation:
25
We'd need to see the actual query along with the table schema for everything used in the query. Do you have indexes set on all fields that you are:
1) ordering by
2) joining on
3) selecting on
Proper indexing is how to really optimize the speed. If you only have indexes on your ID's, like autoincrementing fields, that isn't enough when you have a lot of data or complex queries. Without indexes the db engine has to scan every row in the table(s) to find what it's looking for, which can get exponentially complex depending on the joins and whatnot are used.
Posts: 215
Threads: 16
Joined: Oct 2014
Reputation:
10
What he means is post the actual SQL query. A demo doesn't help without knowing how you've written the statement and what schema the tables are using.