5 Replies Latest reply on Apr 14, 2008 12:52 PM by Newsgroup_User

    cfthread

    markireland
      Can (or should) I put cfthread tags around queries?
        • 1. Re: cfthread
          BKBK Adobe Community Professional & MVP
          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.

          1 person found this helpful
          • 2. Re: cfthread
            markireland Level 1
            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?
            • 3. cfthread
              BKBK Adobe Community Professional & MVP
              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.

              • 4. Re: cfthread
                Level 7
                markireland wrote:
                > 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.

                You need to explore this requirement more to find out its ramifications
                and details.

                Who's form is disabled? The one user who submitted a request that
                triggered the 40 minute query or all users accessing a given form during
                the run time of the query? What actually triggers the query run? A
                user's action or some scheduled task or what? Are users to be notified
                somehow that the query is done and the data is ready to be accessed or
                do they just get access to the form when requested as long as the query
                is not running?

                That short sentence is a lot of complex ramifications to it.
                • 5. Re: cfthread
                  Dan Bracuk Level 5
                  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.