I want to create paging with LINQ to entity (EF) ,I found Skip method but it is only supported for sorted input,so I think it will be slow in large amount of rows. Is any way to paging without sorting it first?
A database is not obliged to return the set of records in same order, for a specific SQL query, without a specific order declared.
You may run the same query and first 10 records be different on each run. Database will execute this based on what is best for itself (what part of data is cached in memory, what parts changed before two executions of the same query and the like).
So regardless of what ORM you use, you have to specify in what order you want the data. And be sure you have a properly defined index for the field that you are ordering the records based on that.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With