Comments on: MySQL Fun http://codespatter.com/2007/05/04/mysql-fun/ Tue, 06 Oct 2009 08:40:41 -0500 http://wordpress.org/?v=2.8.4 hourly 1 By: Greg Allard http://codespatter.com/2007/05/04/mysql-fun/comment-page-1/#comment-9 Greg Allard Fri, 18 Jan 2008 06:06:55 +0000 http://codespatter.com/?p=4#comment-9 After all the fighting to get this to a better table schema, it increased the query I was trying to optimize from 23.0878 seconds to 0.0638 seconds. That's like 36,000% better! After all the fighting to get this to a better table schema, it increased the query I was trying to optimize from 23.0878 seconds to 0.0638 seconds. That’s like 36,000% better!

]]>
By: Greg Allard http://codespatter.com/2007/05/04/mysql-fun/comment-page-1/#comment-13374 Greg Allard Fri, 18 Jan 2008 06:06:55 +0000 http://codespatter.com/?p=4#comment-13374 After all the fighting to get this to a better table schema, it increased the query I was trying to optimize from 23.0878 seconds to 0.0638 seconds. That's like 36,000% better! After all the fighting to get this to a better table schema, it increased the query I was trying to optimize from 23.0878 seconds to 0.0638 seconds. That's like 36,000% better!

]]>
By: Greg Allard http://codespatter.com/2007/05/04/mysql-fun/comment-page-1/#comment-8 Greg Allard Fri, 18 Jan 2008 06:06:36 +0000 http://codespatter.com/?p=4#comment-8 Left the limit out even though I thought it wouldn't be able to do it, but it went through. Affected rows: 4176 (Query took 176.0788 sec) Left the limit out even though I thought it wouldn’t be able to do it, but it went through.

Affected rows: 4176 (Query took 176.0788 sec)

]]>
By: Greg Allard http://codespatter.com/2007/05/04/mysql-fun/comment-page-1/#comment-13373 Greg Allard Fri, 18 Jan 2008 06:06:36 +0000 http://codespatter.com/?p=4#comment-13373 Left the limit out even though I thought it wouldn't be able to do it, but it went through.<br><br>Affected rows: 4176 (Query took 176.0788 sec) Left the limit out even though I thought it wouldn't be able to do it, but it went through.

Affected rows: 4176 (Query took 176.0788 sec)

]]>
By: Greg Allard http://codespatter.com/2007/05/04/mysql-fun/comment-page-1/#comment-7 Greg Allard Fri, 18 Jan 2008 06:06:17 +0000 http://codespatter.com/?p=4#comment-7 I'm doing this UPDATE tbd_requests SET request_taken_time = ( SELECT history_created FROM tbd_history WHERE tbd_history.request_id = tbd_requests.request_id AND history_action LIKE 'taken' ORDER BY history_created DESC LIMIT 0, 1 ) WHERE request_type != 11 ORDER BY request_id ASC LIMIT 0, 1 and getting this #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' 1' at line 13 Fate doesn't want to allow me to restructure this database, it wants me to forever have slow queries. I’m doing this

UPDATE tbd_requests
SET request_taken_time =
(
SELECT history_created
FROM tbd_history
WHERE tbd_history.request_id = tbd_requests.request_id
AND history_action LIKE ‘taken’
ORDER BY history_created DESC
LIMIT 0, 1
)
WHERE request_type != 11
ORDER BY request_id ASC
LIMIT 0, 1

and getting this

#1064 – You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘ 1′ at line 13

Fate doesn’t want to allow me to restructure this database, it wants me to forever have slow queries.

]]>
By: Greg Allard http://codespatter.com/2007/05/04/mysql-fun/comment-page-1/#comment-13372 Greg Allard Fri, 18 Jan 2008 06:06:17 +0000 http://codespatter.com/?p=4#comment-13372 I'm doing this<br><br>UPDATE tbd_requests <br>SET request_taken_time = <br>( <br>SELECT history_created <br>FROM tbd_history <br>WHERE tbd_history.request_id = tbd_requests.request_id <br>AND history_action LIKE 'taken' <br>ORDER BY history_created DESC <br>LIMIT 0, 1 <br>) <br>WHERE request_type != 11 <br>ORDER BY request_id ASC <br>LIMIT 0, 1 <br><br>and getting this <br><br>#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' 1' at line 13 <br><br>Fate doesn't want to allow me to restructure this database, it wants me to forever have slow queries. I'm doing this

UPDATE tbd_requests
SET request_taken_time =
(
SELECT history_created
FROM tbd_history
WHERE tbd_history.request_id = tbd_requests.request_id
AND history_action LIKE 'taken'
ORDER BY history_created DESC
LIMIT 0, 1
)
WHERE request_type != 11
ORDER BY request_id ASC
LIMIT 0, 1

and getting this

#1064 – You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' 1' at line 13

Fate doesn't want to allow me to restructure this database, it wants me to forever have slow queries.

]]>
By: Greg Allard http://codespatter.com/2007/05/04/mysql-fun/comment-page-1/#comment-6 Greg Allard Fri, 18 Jan 2008 06:05:51 +0000 http://codespatter.com/?p=4#comment-6 I think I might need to do some nested query where I set request_taken_time = (SELECT history_created order by blah blah) That may be the only way to get it to work accurately, however it will be slow since it doesn't seem to do nested queries efficiently I think I might need to do some nested query where I set request_taken_time = (SELECT history_created order by blah blah) That may be the only way to get it to work accurately, however it will be slow since it doesn’t seem to do nested queries efficiently

]]>
By: Greg Allard http://codespatter.com/2007/05/04/mysql-fun/comment-page-1/#comment-13371 Greg Allard Fri, 18 Jan 2008 06:05:51 +0000 http://codespatter.com/?p=4#comment-13371 I think I might need to do some nested query where I set request_taken_time = (SELECT history_created order by blah blah) That may be the only way to get it to work accurately, however it will be slow since it doesn't seem to do nested queries efficiently I think I might need to do some nested query where I set request_taken_time = (SELECT history_created order by blah blah) That may be the only way to get it to work accurately, however it will be slow since it doesn't seem to do nested queries efficiently

]]>