Quantcast
Channel: Adobe Community: Message List - ColdFusion
Viewing all articles
Browse latest Browse all 21760

Re: Coldfusion 9 CFTransaction/CFQuery Timeouts

$
0
0

Hey kavig99,

 

So after I ran the server monitor and analyzed my script, I realized how much SQL was actually executing. I had over 100K sql statements executing everytime I ran the import. This is why it was crashing. The solution for me was to restructure my SQL to be more efficient.

 

For example, I had to insert a bunch of child records into a lookup table. I was looping over these child records in ColdFusion and inserting them one at a time. This was causing major performance issues. So, instead of inserting them one by one, I figureout out I can insert the whole group at once by restructuring my SQL. The easiest way I found to do this was to use a INSERT INTO with a SELECT statement to retreive the records you want to insert. (See Below)

 

Instead of doing this for each record: INSERT INTO myTable VALUES('#Value1#','#Value1#')

 

Do this once for all records: INSERT INTO myTable SELECT '#GradeUID#', SizeGroupUID FROM myTable2 WHERE SizeGroupUID IN (<cfqueryparam cfsqltype="cf_sql_varchar" value="#SizeRangeUIDList#" list="true">)

 

Just toy around with restructuring your SQL. After I restructured my SQL my script worked awesome. It was also running 90% less SQL to performe the exact same task.

 

Good Luck Man!

 

-Bob


Viewing all articles
Browse latest Browse all 21760

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>