Question
· Jun 15, 2017

Timeout 504 while running simple SQL count(*) query

Whenever I try to run a simple query on a production database table, I get a timeout 504 error. I'm using the SQL interface in Ensemble. One of the queries is a simple SELECT TOP 10. Even SELECT COUNT(*) gives a timeout. 

I have tried to run the SQL Runtime Statistics, but this gives me a timeout as well. 

Does anyone have an idea where I might look to find what is causing this? 

 

Thanks in advance, 

Best regards

Glenn van Bavel, 

Discussion (3)0
Log in or sign up to continue

If you really are doing just a SELECT COUNT(*) FROM Table does your class have a Bitmap extent?  That is the fastest way to get the answer for a COUNT(*).

If you have a BitMap Extent and the query is still slow then you might need to clean up your bitmap.  For tables that have a large number of rows deleted, Link most Ensemble table, over time a bitmap will slow down.

You can clean them up by using a system utility:  %SYS.Maint.Bitmap

There is not much in the docs about this Util but you can have a look at the Class Reference to see examples of how to use it.