How can we increase t sql query execution time high in ssms

NN 0 Reputation points
2023-08-27T13:27:02.1066667+00:00

How can we increase t sql query execution time high in ssms

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
13,676 questions
{count} votes

2 answers

Sort by: Most helpful
  1. LiHongMSFT-4306 26,706 Reputation points
    2023-08-28T02:22:49.4533333+00:00

    Hi @NN

    If you want to increase application timeout, not query execution time. It'll be changed in the SSMS (because SQL has no concept of a timeout)

    click Tools --> Options --> 'Query Execution' --> 'Execution time-out' ,0 indicates an unlimited wait (no time-out).

    Also, you might try adding a meaningless while loop to increase the execute time of a whole query.

    Best regards,

    Cosmog Hong


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our Documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

  2. Craig Fick 0 Reputation points
    2023-08-28T15:42:22.1+00:00

    I am making assumptions, but this sounds like you are asking how to optimize your query. This can be done a few ways.

    1. Filter out your joins. Say you are joining to a table of states and you only need the State "New York" for instance.

    ex.

    SELECT * FROM Table1 tab

    LEFT JOIN States sta

    ON tab.State = tab.State AND sta.State = 'New York'

    1. Reduce columns to only needed columns.

    ex.

    This 'SELECT State From Table1'

    NOT THIS 'SELECT * FROM Table1'

    1. Avoid functions you might not need like ORDER BY for example.
    2. Remove any redundancy in the code.
    3. Examine the estimated execution plan to see what aspects of your code is slowing down execution time the most and improve that. The higher the Cost % the more taxing the code is on your overall execution time.
      1. Select all of the code you wish to improve.
        1. CTRL + L
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.