Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.tools -> How to Avoid count(*) on web base applictions
Hi
As in most web applications I am presenting data like
first 10 rows from total of 200 rows.
In order to get this total, I must run each query TWICE.
First for count ,and then for actual data.
I believe that solution below can solve the problem
( not to run the "count" query ), but only for queries with order by.
( with no index on "order by" columns )
I want you opinion about my solution:
The below are the steps i issue:
0) decler the currsor for the main query (the query will include order
by)
1) Before opening the currsor i am Runing the below
select VALUE INTO SORT_B from V$MYSTAT
where STATISTIC#=( select STATISTIC# from sys.V_$SYSSTAT where NAME='sorts (rows)' ) ;
where STATISTIC#=( select STATISTIC# from sys.V_$SYSSTAT where NAME='sorts (rows)' ) ;
MY_COUNT will include the some of the order record which are the count of my population
Tnx Received on Mon Jun 25 2001 - 11:54:37 CDT