Skip to Main Content

Breadcrumb

Question and Answer

Chris Saxon

Thanks for the question, Geraldo.

Asked: April 02, 2020 - 11:38 pm UTC

Last updated: April 03, 2020 - 10:18 am UTC

Version: 18.6

Viewed 1000+ times

You Asked

Hello, Ask Tom Team.

I am building a report using Microsoft SQL Server Reporting Services connecting to an Oracle 18c database.

This report will show lots of data. I need to paginate the results, showing 50 rows per page.

1. How can I do it the best way getting the best performance?
2. Does query pagination improve performace?

Note 1: I have read that new FETCH/OFFSET feature since Oracle 12c could be slower than earlier approaches.

Note 2: I had asked this question last week but it seems like it disappeared from your repo.

Thanks in advanced.


and Connor said...

Here's a couple of videos that walks through how to do it, and the best way to do it.

It is true that there are a couple of idiosyncracies with pagination using the 'fetch first' ansi style syntax, but you would need to very unlucky to stumble upon them.

1) The important reasons for doing pagination in the database not in the application



2) Some more advanced considerations



Rating

  (1 rating)

Is this answer out of date? If it is, please let us know via a Comment

Comments

on note#1

Rajeshwaran, Jeyabal, April 03, 2020 - 10:10 am UTC

There was a bug where possible indexes for fetch first were costed incorrectly. This is fixed and has patches going back to 12.1.0.2:

Optimizer PM talks about that in details @ https://blogs.oracle.com/optimizer/fetch-first-rows-just-got-faster

However you are in 18c - so this was fixed in that version.
Chris Saxon
April 03, 2020 - 10:18 am UTC

Good point.

More to Explore

SQL

The Oracle documentation contains a complete SQL reference.