This project is read-only.


PageSize should limit data loaded from database


[Queryable(PageSize = 10)] will only limit the data sent to the client but not the data loaded from database.

This can cause performance issue that SQL server will try to load the whole table to the query.

The correct way is to take PageSize + 1 data from database in order to check if next page is available.
Closed Mar 13, 2013 at 2:11 AM by hongyes


lcharold wrote May 7, 2013 at 3:23 PM

Using nightly build 5.0.0-alpha-130506.

I would expect [Queryable(PageSize = 10)] to generate SQL like SELECT TOP (10) from TABLE. I don't see that. It's generating SELECT from TABLE, returning all records from the DB, and then limits to 10 records on the way out of the controller.

Am I missing something? Is this working as designed?

lcharold wrote May 7, 2013 at 4:10 PM

Never mind.

I was using Microsoft.AspNet.WebApi.Tracing to view the SQL, and apparently it isn't reporting the SQL correctly.

Using IntelliTrace, I see the actual SQL executed is SELECT TOP (11) from TABLE.