This is a migrated thread and some comments may be shown as answers.

Low performance when using IncludeTotalCount(true)

2 Answers 65 Views
Development (API, general questions)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Petr Šatka
Top achievements
Rank 1
Petr Šatka asked on 20 May 2011, 09:40 PM
Hi Telerik.
I am using data virtualization. That means using the method query.IncludeTotalCount(true).

On the server side OpenAccess ORM generates two queries. "SELECT COUNT (1) FROM ..." and " __OAPAGED WITH AS (SELECT *, ROW_NUMBER () OVER (ORDER BY @ @ SPID) AS OA_ROWNUM FROM (SELECT TOP (@ __TAKE)..."

I tested these queries and are very fast (about 1 second for each). But ORM returns results in about 30 seconds. Time depends on the count of records returned by a query SELECT COUNT. (30 seconds is for 961,169 records.) The problem is not the speed of queries, but some strange delay between SELECT COUNT and the second SELECT.

In SQL Profiler I see a "SELECT COUNT (1)..." , then for about 30 seconds nothing happens. And then follows " __OAPAGED WITH AS (SELECT *...".

If I set IncludeTotalCount(false), then query SELECT COUNT is not generated and ORM returns results quickly.

Sorry for my English.

Regards
Peter

2 Answers, 1 is accepted

Sort by
0
Thomas
Telerik team
answered on 25 May 2011, 03:55 PM
Hi Petr Šatka,

do you mean there is a 30 second delay on the client side before the next server side query is issued?
Can you try to increase the connection pool size on your application? If there is no free connection we might wait for executing the second query.

Greetings,
Thomas
the Telerik team
Q1’11 SP1 of Telerik OpenAccess is available for download; also available is the Q2'11 Roadmap for Telerik OpenAccess ORM.
0
Petr Šatka
Top achievements
Rank 1
answered on 31 May 2011, 09:19 PM
Hello Thomas.
It seems that the problem was with the database server.

I appreciate your help.

Regards

Peter
Tags
Development (API, general questions)
Asked by
Petr Šatka
Top achievements
Rank 1
Answers by
Thomas
Telerik team
Petr Šatka
Top achievements
Rank 1
Share this question
or