Re: Need a Fast Row Count

From: <bchorng_at_my-deja.com>
Date: 2000/03/24
Message-ID: <8bgrub$qme$1_at_nnrp1.deja.com>#1/1


In article <38DA4117.74046877_at_lmco.com>, Gary Brumfield <g.brumfield_at_lmco.com> wrote:
> Is there any other way than "select count(*) from <table>" to return
 the
> number of rows in an Oracle table? This takes forever to run (>3
> minutes) on a table that has over 3 million rows. I guess it has to do
> a full table scan to determine the correct number of rows and in a
 read
> consistent manner. It would be OK even if we got a count that was
> fairly close.
>
> Any Ideas or Insight?
>
>
You can make Oracle scan index for a row count ( if index exists ) which would be much faster. There are a couple of ways to do that: if it's rule based opimizer:
1. use hint index_ffs
If it's cost based opimizer:
2. set v733_plans_enabled = true in init.ora for Oracle 7.3 3. set fast_full_scan_enabled = true for Oracle 8 If your select has a where clause, then that column needs to be indexed. -Bass Chorng

Sent via Deja.com http://www.deja.com/
Before you buy. Received on Fri Mar 24 2000 - 00:00:00 CET

Original text of this message