Coldfusion Debug and Heap Space Errors
Coldfusion, RailoI was writing a quick script today to clean up some data for an import using Coldfusion 8. It runs a single query and then loops over the results updating a different table. Now before you roll your eyes I know this is not the best way to do this, but I needed it done quickly. When I would run the page it would stop with a 500 Heap space error and Coldfusion would die. I couldn't figure it out so I decided to try it on a development copy of Railo. The page didn't finish, but I got a Debug out of memory error. Which pointed me in the right direction. I added in <cfsetting showdebugoutput="false"> and the page ran perfectly in Coldfusion 8 and Railo.
This is a good reason you should never have debug turned on in Production :). Extra kudos for the Railo guys though. Railo stayed up and working and also give me the debug information I need to figure out what the heck was going on.
MYSQL Slow Subquery using IN
Coldfusion, mySQLI finally found the correct information today to figure out why some kinds of subqueries take forever to come back in mysql. If you are using a subquery with a MYSQL IN() like this:
select o.ack,o.product
from orders o
where o.ack in (
select distinct ack
from orders
where status in ('Shipped','Cancelled')
group by ack
having DATE_ADD( DATE_SUB( now( ) , INTERVAL DAYOFMONTH( now( ) ) - 1 DAY ) , INTERVAL -3 MONTH ) > max(status_date))
)
order by o.ack, o.line
It takes a few minutes to return a result. If you take the same query and reorder it to put the subquery in the from with a join it comes back almost instanty :
select o.ack,o.product
from orders o
inner join (select distinct ack
from orders
where status in ('Shipped','Cancelled')
group by ack
having DATE_ADD( DATE_SUB( now( ) , INTERVAL DAYOFMONTH( now( ) ) - 1 DAY ) , INTERVAL -3 MONTH ) > max(status_date)) old_o
on o.ack = old_o.ack
order by o.ack, o.lineIt's interesting on MSSQL that the IN() subquery syntax is much faster.
Here's a link to the bug report:
bugs.mysql.com/bug.php (Thanks Jeremy Pointer :) )
Mysql Joined Updates
Coldfusion, mySQLI can never seem to remember the mySQL syntax for JOINED updates when I need them and the mysql documentation on their site doesn't help a whole lot. Then I always forget what the exact phase to google for. (Joined updates, multi-table updates, updating from one table to another, etc..) I found some great examples over on the electictoolbox that makes it dead simple.
So I am posting it here as a reminder later on , and in case someone else was wondering how to do it and couldn't find it.
ELECTRICTOOLBOX JOINED UPDATE EXAMPLES
Persistent Storage for Amazon EC2
Cool StuffOn the heals of GOOGLE Apps having persistent storage Amazon decides to add it as well. This was the only major issue I had with EC2 as I didn't "get" how it would all work with S3. It seems they are planning to add an unformatted harddrive that you can partition and format to your heart's desire. There will even be an API to backup the harddrive to S3.
This is a very exciting development, I can't wait to try it out.
http://developer.amazonwebservices.com/connect/thread.jspa?threadID=21082






Loading....