I've noticed that the first time an ExecuteSQL statement is run to collect studentIDs for writing new records in other tables, that script takes a long time. The first time it takes a long time, the 2nd, 3rd, and other times it runs instantly. Why does it need to 'warm up' first?
Let me describe my situation:
The teachers at our high school see a list via a portal of the kids who are in the class, each period through a portal. The teacher uses a IncHmk_Boolean field to mark the students who have incomplete homework. At the bottom of the screen is a button that uses an executeSQL statement to collect all the IDs of the students who have that boolean field checked. It then writes that list to a new table for updating later on.
All my teachers report that the first time they press the button it takes 20-30 seconds to process, that is to collect the student IDs. Going to a new class, they do the same thing, and the script runs in a heart-beat or less.
The script collects the IDs through the executeSQL statement into a local variable.
Ive noticed this happening in the script debugger as well. The first time i run the script, the debugger hangs on the ExecuteSQL statement. If I make a change to the script and run it again through the debugger, the script sails through the SQL step, writing the correct data to the variable.
Has anyone noticed this? Why would ExecuteSQL need a warm up? Does it have to do with the TO that its pulling from? Do more WHERE conditions slow it down?