27
Views
5
Comments
Timeout when using SQL to delete all data in Outsystems table
Question

Hi, i am trying to delete all data in Oustsytem table . but getting error time out. please guide me on how can i delete all of data in this table 

query that i have tried : 

DELETE FROM {TempRiskScoreData}; 

DELETE {TempRiskScoreData};

TRUNCATE TABLE {TempRiskScoreData}; 

DELETE FROM {TempRiskScoreData}WHERE {TempRiskScoreData}.[Id] IN (    SELECT TOP (@BatchSize) {TempRiskScoreData}.[Id]    FROM {TempRiskScoreData});


error : Database returned the following error: Error in advanced query SQL1: Execution Timeout Expired.  The timeout period elapsed prior to completion of the operation or the server is not responding. 


2026-01-28 16-57-48
Mihai Melencu
Champion

Hi @Najwa Hasim ,

Where exactly are you using the SQL node, and how are you calling the delete action?

You should handle this in a server action and trigger it with a timer. 

2026-03-12 10-32-06
Wahaj Adil

hi @Najwa Hasim , hope you are doing well.

for your query of timeout ; 
you are getting a timeout error because the {TempRiskScoreData} likely has alot of records and trying to delete everything at once is too much for the server to handle within the allowed time.

what I suggest is , instead of deleting all records at once, try removing them by looping them in smaller chunks using a Timer or ServerAction in OutSystems. This may help to avoid overloading the server and prevents timeout errors.

Thanks and Regards.

UserImage.jpg
Najwa Hasim

hi @Mihai Melencu Im using it in a server action .  it is a simple server action start->sql delete-> end 

2026-01-28 16-57-48
Mihai Melencu
Champion

You can change the value of the Timeout property of the advanced SQL node.

The value is in seconds.

Also, you can check this article on this topic: Timeouts under the hood

2025-08-07 06-30-56
Amit J
Champion

Hi,

Best Ways to Delete All Data from an OutSystems Table

1. Use BATCHED DELETE in a Loop (Recommended)

Break the deletion into small chunks (e.g., 1000 rows per batch):

DELETE FROM {TempRiskScoreData}

WHERE {TempRiskScoreData}.[Id] IN (

  SELECT TOP (@BatchSize) {TempRiskScoreData}.[Id]

  FROM {TempRiskScoreData}

)
Run this inside a Server Action with a loop, repeating until no more rows are deleted.

Use @BatchSize = 1000 or lower based on DB performance.


2. Alternative: Use Timer for Deletion

If you're dealing with massive datasets, use a Timer module:

  • Timer logic runs outside request timeout limits.

  • Create a batch-delete loop in the Timer logic.

  • Schedule the Timer or call it on-demand.



Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.