Count(1) over() recordCount slows down performance. Is there any alternative for this?
I am using count(1) over() recordCount to get the total number of records returned by the query and this appends along with the result. My query is something like this
select count(1) over() recordCount ,a.column1 ,b.column2 from table_1 a left join table_2 b on a.column_1 = b.column_1
With this clause place in a query the execution time is ~31 secs
But when i remove this clause, the execution time is ~5 secs.
Is there any alternative way to get the count of number of records returned by a query.
Something like the ROWCOUNT function in Oracle.