Hello, I am using Oracle 19c and have a very large partitioned table which is made up of JSON data. I am trying to extract just the first record of each partition using this query:
SELECT * FROM(
SELECT
Column_1, Partition_Column, row_number()over ( partition by Partition_Column order by rownum) as rn
FROM table)
Where rn = '1'
Since my table is very large, it still takes a while. When I just grab the first row of the overall table:
Select * FROM table fetch first row only
This is almost instant.
I am just wondering if there is a faster way to grab the first record of each partition instead of using the row_number() function with the order by clause since I am not sorting out of the default order.
Below is an image of the data in the table. The two highlighted records are what I am trying to extract that first record for each partition. Please note, this is just an example, and there are a lot more records for each partition. As you can see, the highlighted records are a different format then the rest of the JSON in the table and act as reference points for all of the other data elements. That is why I am trying to pull those out separately. 