Dear community,
All of a sudden, it seems, my project took 10-20 minutes to open the first document. Subsequent documents open at normal speed.
I was at a loss where to look for the cause of this sudden delay.
Some more details:
- This started happening from when I created a new branch with an application ID that is not lowest, so that I have to switch available applications
- The initial documents I tested have very limited screen types, these could not be the cause.
It turned out that the delay was caused by out of date statistics on the database server.
After running
exec tsf_optimize
the wait for the initial document dropped from 800 seconds to 1 second. That's what I call improvement!
Is it an option to have the deployment center add these optimize scripts to the job scheduler / SQL Agent / Indicium process flow ?
Preferably, implement this using a standard system flow, rather than a SQL server job. This way, SQL Server Express will also be supported.
If this does happen then there should also be an option to disable this. Rebuilding indexes daily is not always best practice and should be tuned/considered depending on the project scale. Also for larger projects the settings used for index rebuild or update statistics might have to be tweaked.
From platform version 2022.2, the Software Factory (sqlserver_sf) application in the Intelligent Application Manager (IAM) will have a system flow called "system_flow_run_tsf_optimize”. This system flow will run the tsf_optimize procedure in accordance to its active custom schedule.
By default, this system flow does not have any schedules. If you would like to use this system flow, you can disable the prefilter "Active” in the Scheduled system flows screen, then selecting the system flow and creating a custom schedule. Set the desired schedule Active to let Indicium run this system flow at the indicated intervals.
Hi@Arie V ,
The tsf_optimize procedure is a procedure inside the DB base project. In Functionality, if you disable the Hide generated prefilter and search for "sql_tsf_optimize”, you can see the exact code the tsf_optimize procedure runs.
You can of course use this procedure for your own end product databases by creating a Task that executes the tsf_optimize procedure. This Task can then be used inside a system flow using the Execute system task process action. We will create a Thinkstore solution for this for all others to download. This will be similar with the implementation as I described in my previous reply in this topic. When this solution will be available, I cannot say for sure at the moment.
The Optimize indexes task in IAM does indeed use a Task that executes the tsf_optimize procedure. This runs tsf_optimize for the IAM database, not for any other databases. We could also schedule this to run, the only problem is that the IAM application is not visible to users so no other schedule could be used. Therefore we would have to create an option. If this is really desired, feel free to create an Idea. Alternatively, you can create a system flow running a Application connector for the IAM application. Then as code,
exec tsf_optimize
What does the tsf_optimizer do:
It does two things:
Hope this helps!