Skip to main content
markireland
Known Participant
April 11, 2008
Answered

cfthread

  • April 11, 2008
  • 2 replies
  • 773 views
Can (or should) I put cfthread tags around queries?
This topic has been closed for replies.
Correct answer Dan_Bracuk
40 minutes is huge for a query. What you want to do is:

1. Ask yourself why it takes so long.
2. Figure out a way to run it without making the user wait.

cfthread is not your answer.

2 replies

BKBK
Community Expert
Community Expert
April 14, 2008
The app will disable forms while the query is running and re-enable when its finished.

Is that easy to achieve, or even possible? If you do it with cfthread or with cfexecute Coldfusion will spawn a thread away from the current page. I don't see how you will disable a form on the page till the spawned process is complete.

BKBK
Community Expert
Community Expert
April 13, 2008
You can. You shouldn't create extra threads unless you need to. Threads consume resources, are difficult to manage in a program and may cause deadlock. Remember that a query represents a potential complication, as it makes a connection to an external server, the database server.

markireland
Known Participant
April 13, 2008
I have been asked to include a query that will take 40 minutes.
The app will disable forms while the query is running and re-enable when its finished.

Should I cfexecute a script instead?
Dan_BracukCorrect answer
Inspiring
April 14, 2008
40 minutes is huge for a query. What you want to do is:

1. Ask yourself why it takes so long.
2. Figure out a way to run it without making the user wait.

cfthread is not your answer.