We have situation where query takes time through SSIS packages during the weekend run whereas its run in 3 mins during weekdays run. There is considerable increase in the records count but with that it should run in max of 15 mins duration.
We have found temporary solution to overcome this but this one is manual effort need to performed every weekend run.
Temporary solution is, we run the SQL task source query in the SSMS before the package gets triggered from a job.
Whereas the query running through will also take longer time execute but we abort manually ran query. This creates Execution plan Cache of that DB server.
After this when query runs from package it will execute in 3 mins regardless the no of records.
Kindly let us know if any permanent fix can be done for this.
Thanks,
SANDY
Related
I have a SQL query, first I analyzed the query by executing and it is taking less than 1 ms.
So I used the query in my spring boot app, and tried to execute it using
namedParameterJdbcTemplate.query(sqlQuery, params, new validationMapper());
but when I see the time, it is 19212ms.
Why this much time difference?
I've a strange problem with a postgres 10 database.
After restoring a table with around 2 million record i tried to run a query to measure it's execution time since it has been acting slow on another server.
Shortly after the restore the query was executing in about 1.5 seconds.
After around one hour the same query was executing in 30/40 seconds.
The query is nothing fancy :
SELECT f1,f2,f3 FROM table WHERE f4=false
The planned execution is the same has before.
No writes has been done on the table and the server wasn't on load from other tasks.
How this is possible ? how can i investigate the cause of the problem ?
I am trying to run a simple select statement and each time I run it it takes a different amount of time to complete.
The first time takes 0 seconds, the second time it takes 3 seconds and the third time it takes 10 seconds. And if run again the query will start from 0,3,10 and keeps going on.
Why is this happening? It seems there is some kind of logic behind it.
This is causing the service that uses the database to timeout.This query is run by a specific software for thousands of times.
SQL Query:
SELECT * FROM CONTACT_CONTACT WITH (NOLOCK) WHERE MKEY ='XXXXXXXXXXXX'
I am using SQL Server 2012. The db contains 369 tables. The table CONTACT_CONTACT contains 62497 records.
On a legacy SQL 2000 box that is awaiting upgrade
Does anyone have a script to kill / abort a job in SQL Agent 2000 if it over runs a set duration or overlaps with another agent job.
This is causing us a serious problem every few weeks a job overuns then locks the reindex job and that freezes our 24 / 7 server
One solution would be to add a step at the beginning of the job with which the long-running job overlaps which checks whether the long-running job is still running, and if it is issue an sp_stop_job command.
You can get the current execution status of a job using sp_help_job, but its output is not very easy to manipulate in a query.
Various methods of coercing the output of sp_help_job into a temp table in SQL 2000 are discussed here - alternatively you can query msdb.sysjobhistory to get the execution status information.
Is it possible to make Job Schedule, which will occur every less than 10 seconds?
Because Sql server doesn't allow that.
Schedule type is "Recurring" and Occurs "Daily".
Select occurs Daily and run every 10 seconds. Although keep in mind if your job takes longer than the time specified to run, the agent won't invoke it again until the running task completes.
See comments below. The UI tool doesn't allow input for less than 10 seconds. In your case you could schedule two job tasks offset by some number of seconds. The issue then is that the jobs could overlap as they are distinct tasks as far as SQL Agent knows.
I tried do something similar (SQL Server job with prcise timing), but the only reliabile way I found was custom windows service execution SQL statements.