Page 1 of 1

Using a sql server execution plan

Posted: Tue 09 Mar 2010 11:41
by brace
In my application I use a very complex query. When I run that query in SQL Server management studio it takes 16 seconds to execute the first time and 2 seconds the second time. This is because the query execution plan is created.

When using it from Delphi application it is always like the first time (very slow).

Is it a way I can assign an execution plan to a query or any way I can use sdac to take advantage of this?

Or are you aware to another way to do it even if sdac doesn't support this?

Thanks.

Posted: Fri 12 Mar 2010 10:23
by Challenger
You can call the Prepare method of TMSQuery.

Posted: Fri 12 Mar 2010 11:57
by brace
I don't see any sugnificant difference by using Prepare.

Posted: Mon 22 Mar 2010 09:57
by Dimon
Please, check that you call the Prepare method only once, and after that execute a query a few times.

Posted: Thu 25 Mar 2010 10:47
by brace
Ok I will try.