Glancing at the query, I'm already under the impression that it should
be broken up into multiple queries and code should be used to simulate
the behavior. I find that this method is faster for mysql and a bit more
portable for developers in my opinion.

Other then what is stated above I would have to run it by hand to
determine what the purpose of this query is. Then see if it can be
rewritten.


- Dathan Vance Pattishall
  - Sr. Programmer and mySQL DBA for FriendFinder Inc.
  - http://friendfinder.com/go/p40688


-->-----Original Message-----
-->From: Matt Babineau [mailto:[EMAIL PROTECTED]
-->Sent: Thursday, October 23, 2003 12:05 PM
-->To: [EMAIL PROTECTED]
-->Subject: Improving Query speed - any suggestions?
-->
-->Hey All-
-->
-->I am trying to improve the speed of a website and was wondering if
-->anyone had any ways I can rewrite these queries so that they actually
-->run with some descent speed.
-->
-->Its a really nasty query and I'm not sure where to start, I'd like to
-->now have to redo the tables and I already put some indexes on it
which
-->improved speed a lot but these queries are still very slow. You can
most
-->certainly laugh to yourselves on this one... jsut trying to get some
-->opinions on what I should do with this.
-->
-->Thanks-
-->Matt
-->
-->SELECT content.row_id AS row_id, content.app_id AS app_id, s1.data AS
-->niche, s2.data AS type, s3.data AS title, s4.data AS description,
-->s5.data AS image, s6.data AS last_update, s7.data AS content_link,
-->s8.data AS unique_id, s9.data AS date_added, s10.data AS
-->content_provider, s11.data AS user_hits, s12.data AS vote_total,
-->s13.data AS vote_user_total, s14.data AS channel FROM content LEFT
JOIN
-->content s1 ON s1.field_id=69 AND s1.row_id = content.row_id LEFT JOIN
-->content s2 ON s2.field_id=70 AND s2.row_id = content.row_id LEFT JOIN
-->content s3 ON s3.field_id=71 AND s3.row_id = content.row_id LEFT JOIN
-->content s4 ON s4.field_id=72 AND s4.row_id = content.row_id LEFT JOIN
-->content s5 ON s5.field_id=73 AND s5.row_id = content.row_id LEFT JOIN
-->content s6 ON s6.field_id=74 AND s6.row_id = content.row_id LEFT JOIN
-->content s7 ON s7.field_id=76 AND s7.row_id = content.row_id LEFT JOIN
-->content s8 ON s8.field_id=84 AND s8.row_id = content.row_id LEFT JOIN
-->content s9 ON s9.field_id=129 AND s9.row_id = content.row_id LEFT
JOIN
-->content s10 ON s10.field_id=116 AND s10.row_id = content.row_id LEFT
-->JOIN content s11 ON s11.field_id=118 AND s11.row_id = content.row_id
-->LEFT JOIN content s12 ON s12.field_id=120 AND s12.row_id =
-->content.row_id LEFT JOIN content s13 ON s13.field_id=121 AND
s13.row_id
-->= content.row_id LEFT JOIN content s14 ON s14.field_id=125 AND
-->s14.row_id = content.row_id WHERE content.app_id = 11 AND
-->unix_timestamp(s6.data)-unix_timestamp('2003-10-23 23:59:59') < 0
GROUP
-->BY row_id ORDER BY last_update desc LIMIT -1
-->
-->
-->--
-->MySQL General Mailing List
-->For list archives: http://lists.mysql.com/mysql
-->To unsubscribe:
-->http://lists.mysql.com/[EMAIL PROTECTED]




--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to