Pagination over large tables slow
See original GitHub issueThere is a significant performance drop in Oracle’s adapter for EF Core compared to EF6 when selecting from a table with 2 million rows. EF6 is using a different approach for computing the row number required for paging.
EF6
SELECT *
FROM (
SELECT
"Extent1"."Id" AS "Id"
FROM ( SELECT "Extent1"."Id" AS "Id", row_number() OVER (ORDER BY "Extent1"."Id" DESC) AS "row_number"
FROM "Table" "Extent1"
) "Extent1"
WHERE ("Extent1"."row_number" > :p__linq__0)
ORDER BY "Extent1"."ID" DESC
)
WHERE (ROWNUM <= (:p__linq__1))
EF Core
Select
K0 "Id"
from (
select
"m2".*,
rownum r2
from
(
SELECT "t"."Id" K0
FROM "Table" "t"
ORDER BY "t"."Id" DESC
) "m2"
) "m1"
where r2 > :p_0
and r2 <= (:p_0 + :p_1)
I am using Oracle 11g (11.2.0.3.0) and have set compatibility level to 11 when configuring the DbContext.
Issue Analytics
- State:
- Created 3 years ago
- Comments:31 (16 by maintainers)
Top Results From Across the Web
Seek paginated query gets progressively slower on a big ...
Seek paginated query gets progressively slower on a big table ; SELECT ; = ; NULL ; timestamp ; 'a58b' ; OR ;,...
Read more >Why is Offset Pagination So Slow - Level Up Coding
In short, the offset limit pagination performs generally slower than the cursor pagination when handling large offset. However, the choice of ...
Read more >[TIL-6] Why pagination is slow? - davidasync - Medium
Pagination is a process that is used to divide large data into smaller discrete pages, and this process is also known as paging....
Read more >Efficient Pagination on MySQL – Iterate Over Large Tables
Some devs are complaining that their queries - using offset - are getting really slow when they iterate over a really big MySQL...
Read more >Pagination: Slow ORDER BY with large LIMIT range
The large the limit, the more it takes to complete making the page slow to load. I have already added indexes, however it...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Got the repro. We’ll take a look.
@iulianb I just toggled the bug status to be viewable to customers. Within 24 hours, you should be able to view the bug from MOS. I don’t know why Oracle Support couldn’t find it. They should be able to view internal bugs.