Home » SQL & PL/SQL » SQL & PL/SQL » How to improve select coun(*) from table (Oracle 9i)
How to improve select coun(*) from table [message #343946] Thu, 28 August 2008 08:50 Go to next message
**Snake**
Messages: 47
Registered: December 2005
Location: Italy
Member
Hi guys...i need to improve program performance.

I have a program that include this query

select count(*) from table


The table has about 2000000 of records and the table is analyzed (compute statistics).

Some times the query run in about 40 seconds.
Is there a way to improve the statement ??

If I run explain plan:

cost = 4
cardinality = 1
Re: How to improve select coun(*) from table [message #343948 is a reply to message #343946] Thu, 28 August 2008 08:52 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
move the table to a new/different tablespace
Re: How to improve select coun(*) from table [message #343949 is a reply to message #343946] Thu, 28 August 2008 08:52 Go to previous messageGo to next message
SUHAS22845
Messages: 51
Registered: August 2008
Location: BANGALORE
Member

are there duplicate records in the table ? ?

if so then try distinct(count(*))
Re: How to improve select coun(*) from table [message #343953 is a reply to message #343949] Thu, 28 August 2008 08:57 Go to previous messageGo to next message
ThomasG
Messages: 3212
Registered: April 2005
Location: Heilbronn, Germany
Senior Member
I've heard rumours that Oracle also seems to support some newfangled thing that is called "indexes".

Word on the street is that they also tend to speed stuff up.
Re: How to improve select coun(*) from table [message #343955 is a reply to message #343949] Thu, 28 August 2008 09:01 Go to previous messageGo to next message
**Snake**
Messages: 47
Registered: December 2005
Location: Italy
Member
No...There aren't duplicate rows.
I've also improved PGA size...but nothing Sad
Re: How to improve select coun(*) from table [message #343959 is a reply to message #343946] Thu, 28 August 2008 09:05 Go to previous messageGo to next message
SUHAS22845
Messages: 51
Registered: August 2008
Location: BANGALORE
Member

u can aswell flag this table off and create a new table with the similar structure and data

like

create table table_name as select * from (your table name),

and try...
Re: How to improve select coun(*) from table [message #343964 is a reply to message #343953] Thu, 28 August 2008 09:08 Go to previous messageGo to next message
**Snake**
Messages: 47
Registered: December 2005
Location: Italy
Member
ThomasG wrote on Thu, 28 August 2008 15:57
I've heard rumours that Oracle also seems to support some newfangled thing that is called "indexes".

Word on the street is that they also tend to speed stuff up.


I'm using the index.
In the explain plan there's the INDEX FAST FULL SCAN on the right index.
Re: How to improve select coun(*) from table [message #343968 is a reply to message #343946] Thu, 28 August 2008 09:13 Go to previous messageGo to next message
aparangi_rhl
Messages: 10
Registered: January 2006
Junior Member
If you have any primary key on the table, it is beneficial to rewrite the query as

select count(<<Primary Key column>>) from <<table name>>;

Try to execute by substituting the primay key column name in the query and record the time.
Re: How to improve select coun(*) from table [message #343970 is a reply to message #343968] Thu, 28 August 2008 09:15 Go to previous messageGo to next message
**Snake**
Messages: 47
Registered: December 2005
Location: Italy
Member
I've the same result Sad

I've tried to run explain plan and the plan of two queries ( count(*) and count(field) is the same.
Re: How to improve select coun(*) from table [message #343979 is a reply to message #343968] Thu, 28 August 2008 09:24 Go to previous messageGo to next message
dwarak.k
Messages: 61
Registered: June 2008
Location: Hyderabad
Member
@aparangi_rhl
Not really! Using a count(primary key) is not going to improve performance.
Examples here
http://www.oracledba.co.uk/tips/count_speed.htm
Re: How to improve select coun(*) from table [message #344015 is a reply to message #343979] Thu, 28 August 2008 10:26 Go to previous messageGo to next message
Michel Cadot
Messages: 68737
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
It depends on the case, but anyway Oracle optimizer will choose the right path as soon as statistics are up to date.

Regards
Michel
Re: How to improve select coun(*) from table [message #344043 is a reply to message #343946] Thu, 28 August 2008 12:26 Go to previous messageGo to next message
coleing
Messages: 213
Registered: February 2008
Senior Member
If you are on a multi-processor multi disk system, this might speed it up.

select /*+ PARALLEL(a,8) */ count(*) from table a;
Re: How to improve select coun(*) from table [message #344046 is a reply to message #344043] Thu, 28 August 2008 12:30 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
coleing wrote on Thu, 28 August 2008 10:26
If you are on a multi-processor multi disk system, this might speed it up.

select /*+ PARALLEL(a,8) */ count(*) from table a;




Then again it might not.
Re: How to improve select coun(*) from table [message #344132 is a reply to message #343946] Thu, 28 August 2008 17:04 Go to previous messageGo to next message
Kevin Meade
Messages: 2103
Registered: December 1999
Location: Connecticut USA
Senior Member
INDEX FAST FULL SCAN is usually the fastest way to do a count but for this to happen you need at least one index where the leading column is defined in the table as NOT NULL. Usually this means the PK. If you are doing a fast full scan of an index, then one way to get more speed is to compress the index to make it take less space. But if this is a single column index then do not bother because these will not compress. You might also try changing your pctused/pctfull parameters to make oracle use more space in each index block and again use less space.

however, the above fixes will not likely create a game changing difference in you count speeds, only minor improvements at best. Seems to me, once you get index fast full scan, you are pretty much getting the fastest plan.

There are of course many obscure things you could do under special circumstances but they all require work and are bascally kludges and involve some kind of "APPLICATION APPROACH" to the problem. For example: if the table was some kind of time based table where rows are always added to the end (meaning current period in time), then you could partition the table its time key. Then you could count the number of rows in all the partitions that never change and store this value in a working table somewhere. When you want to know the rowcount in the table you count only the last partition and add that count to your saved count to get a total. Of course this is a nightmare for maintenance and DBAs, but it does work and is much faster on huge tables of this kind. There are many special case things like this but they only work if you have the right situations and are willing to pay for the performance somewhere else.

Good luck, Kevin
Re: How to improve select coun(*) from table [message #344185 is a reply to message #343946] Fri, 29 August 2008 00:54 Go to previous messageGo to next message
srihari5691
Messages: 2
Registered: August 2008
Location: Chennai
Junior Member


Hi,
To improve the performance,
You may use
Select count(1) from <table_name>;
instead of
Select count(*) from <table_name>;

Try and give your feed back

Rgds
Srihari
Re: How to improve select coun(*) from table [message #344187 is a reply to message #344185] Fri, 29 August 2008 00:56 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
srihari5691 wrote on Thu, 28 August 2008 22:54

Hi,
To improve the performance,
You may use
Select count(1) from <table_name>;
instead of
Select count(*) from <table_name>;

Try and give your feed back

Rgds
Srihari


Please post reproducible test case.
Re: How to improve select coun(*) from table [message #344199 is a reply to message #344043] Fri, 29 August 2008 01:38 Go to previous messageGo to next message
**Snake**
Messages: 47
Registered: December 2005
Location: Italy
Member
coleing wrote on Thu, 28 August 2008 19:26
If you are on a multi-processor multi disk system, this might speed it up.

select /*+ PARALLEL(a,8) */ count(*) from table a;



It doesn't work.
It's worst than not parallel query.
Re: How to improve select coun(*) from table [message #344203 is a reply to message #344199] Fri, 29 August 2008 01:45 Go to previous messageGo to next message
Michel Cadot
Messages: 68737
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
2000000 is too small to get improvement with parallelism.

Regards
Michel
Re: How to improve select coun(*) from table [message #344211 is a reply to message #344185] Fri, 29 August 2008 01:57 Go to previous messageGo to next message
dwarak.k
Messages: 61
Registered: June 2008
Location: Hyderabad
Member
@ Srihari
Count(1) is same as count(*).Count(1) is internally optimized by Oracle to count(*)

There is no performance benefit using count(1) over count(*)

Extensive discussions here
http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:1156151916789
and
http://asktom.oracle.com/pls/asktom/f?p=100:11:4223916384943050::::P11_QUESTION_ID:1156159920245
Regards,
Dwarak.K
Re: How to improve select coun(*) from table [message #344217 is a reply to message #344211] Fri, 29 August 2008 02:05 Go to previous messageGo to next message
srihari5691
Messages: 2
Registered: August 2008
Location: Chennai
Junior Member

Hi,
To improve the performance,
You may use
Select count(1) from <table_name>;
instead of
Select count(*) from <table_name>;

Try and give your feed back

Rgds
Srihari
Re: How to improve select coun(*) from table [message #344218 is a reply to message #344217] Fri, 29 August 2008 02:08 Go to previous messageGo to next message
Michel Cadot
Messages: 68737
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
Was wrong the first time, is still wrong this time.
You can repeat it as many times as you want, it will always be WRONG.

Regards
Michel
Re: How to improve select coun(*) from table [message #344233 is a reply to message #343946] Fri, 29 August 2008 02:42 Go to previous messageGo to next message
**Snake**
Messages: 47
Registered: December 2005
Location: Italy
Member
There's an issue.
I don't know why, but if I run

select * from table


the query seems append.

It doesn't finish.

On Ent.Manager the long operation seems blocked on 49%

Shocked
Re: How to improve select coun(*) from table [message #344234 is a reply to message #343946] Fri, 29 August 2008 02:50 Go to previous messageGo to next message
**Snake**
Messages: 47
Registered: December 2005
Location: Italy
Member
The "select * from table" query is finished after about 800 seconds Confused Confused

Just a thing.
On this table there was 7500000 records.
Now, after a delete, there's about 2000000 records.

I've reanalyzed the table...but I don't know if I need to rebuild the PK.

???

[Updated on: Fri, 29 August 2008 02:52]

Report message to a moderator

Re: How to improve select coun(*) from table [message #344246 is a reply to message #344234] Fri, 29 August 2008 03:39 Go to previous messageGo to next message
dwarak.k
Messages: 61
Registered: June 2008
Location: Hyderabad
Member
Yup.You should be rebuilding your Index.
If more than 20% of your rows are deleted,your index has to be rebuild to gain the maximum efficiency.

You should be doing an Analyze index <index_name> validate structure.

Check your index statistics. from index_stats before altering

Step 1 : alter index <index_name> rebuild.
Step 2 : Analyze index <index_name> validate structure.


You can take a look at this article
http://www.quest-pipelines.com/newsletter-v2/rebuild.htm

Looking forward for your feedback Smile good luck

Regards,
Dwarak

[Updated on: Fri, 29 August 2008 03:41]

Report message to a moderator

Re: How to improve select coun(*) from table [message #344248 is a reply to message #344246] Fri, 29 August 2008 03:51 Go to previous messageGo to next message
**Snake**
Messages: 47
Registered: December 2005
Location: Italy
Member
Is necessary to specify REBUILD ONLINE option ?
Re: How to improve select coun(*) from table [message #344253 is a reply to message #344248] Fri, 29 August 2008 04:04 Go to previous messageGo to next message
dwarak.k
Messages: 61
Registered: June 2008
Location: Hyderabad
Member
Depends on your requirement

Quote:

Online Index Rebuild Features:
+ ALTER INDEX REBUILD ONLINE;
+ DMLs are allowed on the base table
+ It is comparatively Slow
+ Base table is referred for the new index
+ Base table is locked in shared mode and DDLs are not possible
+ Intermediate table stores the data changes in the base table, during the index rebuild to update the new index later

Offline Index Rebuild Features:
+ ALTER INDEX REBUILD; (Default)
+ Does not refer the base table and the base table is exclusively locked
+ New index is created from the old index
+ No DML and DDL possible on the base table
+ Comparatively faster

Re: How to improve select coun(*) from table [message #344258 is a reply to message #344246] Fri, 29 August 2008 04:29 Go to previous messageGo to next message
JRowbottom
Messages: 5933
Registered: June 2006
Location: Sunny North Yorkshire, ho...
Senior Member
Odd - you'd think that if the situation was so ard and fast, then Oracle would have automated it.....

There may be a slight gain in performance for index range scans, as there will be fewer blocks to read, but index unique scans will notice no improvement.

Additionaly, you may incurr downtime or slower access to the table when you rebuild the index, AND, if you continue to do inserts into the table , you may well slow them down as Oracle has to split the index blocks that you just consolidated back down into multiple blocks.

In summary, if you perform a major operation that deletes a large quantity of data, you might want to consider rebuilding the indexes, but otherwise just don't do it.

Re: How to improve select coun(*) from table [message #344263 is a reply to message #343946] Fri, 29 August 2008 04:35 Go to previous messageGo to next message
**Snake**
Messages: 47
Registered: December 2005
Location: Italy
Member
Now it works.

My operations:

Elapsed: 00:00:00.02
10:59:32 SQL> 
10:59:32 SQL> 
10:59:33 SQL> SELECT name,height,lf_rows,lf_blks,del_lf_rows,distinct_keys,used_space FROM INDEX_STATS;

NAME                               HEIGHT    LF_ROWS    LF_BLKS DEL_LF_ROWS DISTINCT_KEYS USED_SPACE
------------------------------ ---------- ---------- ---------- ----------- ------------- ----------
I_SCCARD_SERIAL_SHP                     4    2307107      61114        7827       2305625   51752799

Elapsed: 00:00:00.02
11:00:21 SQL> SELECT name,height,lf_rows,del_lf_rows,(del_lf_rows/lf_rows)*100 as ratio FROM INDEX_STATS;

NAME                               HEIGHT    LF_ROWS DEL_LF_ROWS      RATIO
------------------------------ ---------- ---------- ----------- ----------
I_SCCARD_SERIAL_SHP                     4    2307107        7827 .339256047

Elapsed: 00:00:00.02
11:01:39 SQL> alter index I_SCCARD_SERIAL_SHP rebuild online;


Index altered.

Elapsed: 00:07:09.90
11:13:05 SQL> 11:13:05 SQL> 
11:14:00 SQL> 
11:14:00 SQL> 
11:14:01 SQL> analyze index i_sccard_serial_shp validate structure;

Index analyzed.

Elapsed: 00:00:24.46
11:14:31 SQL> SELECT name,height,lf_rows,lf_blks,del_lf_rows,distinct_keys,used_space FROM INDEX_STATS;

NAME                               HEIGHT    LF_ROWS    LF_BLKS DEL_LF_ROWS DISTINCT_KEYS USED_SPACE
------------------------------ ---------- ---------- ---------- ----------- ------------- ----------
I_SCCARD_SERIAL_SHP                     3    2299280      14553           0       2299280   50843165

Elapsed: 00:00:00.02
11:15:12 SQL> SELECT name,height,lf_rows,del_lf_rows,(del_lf_rows/lf_rows)*100 as ratio FROM INDEX_STATS;

NAME                               HEIGHT    LF_ROWS DEL_LF_ROWS      RATIO
------------------------------ ---------- ---------- ----------- ----------
I_SCCARD_SERIAL_SHP                     3    2299280           0          0

Elapsed: 00:00:00.02
11:16:58 SQL> 



Now, select count(*) responds in 0.5 seconds.

Smile

Thank you dwarak.k
Thank you guys Smile
Re: How to improve select coun(*) from table [message #344284 is a reply to message #344263] Fri, 29 August 2008 05:36 Go to previous messageGo to next message
JRowbottom
Messages: 5933
Registered: June 2006
Location: Sunny North Yorkshire, ho...
Senior Member
I really doubt that this has reduced the time from 40 seconds to 0.5 seconds, unless you deleted 79/80 of your data.

The performane improvement that you get by rebuilding the index is roughly proportional to the decrease in size of the table.

Example:
create table test_0070 (col_1 number, col_2 varchar2(100));

insert into test_0070 select level, rpad(' ',100,'A') from dual connect by level <= 7000000;

alter table test_0070 add constraint test_0070_pk primary key (col_1) using index;

declare
  v_time   pls_integer;
  v_val    pls_integer;
begin
  v_time := dbms_utility.get_time;
  for i in 1..10 loop
    select count(*) into v_val from test_0070;
  end loop;
  
  dbms_output.put_line('Original '||to_char(dbms_utility.get_time - v_time));

  delete test_0070 where to_number(substr(substr(to_char(col_1,'0000000'),-3),1,2)) <= 70;
  
  v_time := dbms_utility.get_time;
  for i in 1..10 loop
    select count(*) into v_val from test_0070;
  end loop;
  
  dbms_output.put_line('After Delete '||to_char(dbms_utility.get_time - v_time));  
  
  execute immediate 'alter index test_0070_pk rebuild';   
  
  v_time := dbms_utility.get_time;
  for i in 1..10 loop
    select count(*) into v_val from test_0070;
  end loop;
  
  dbms_output.put_line('After Rebuild '||to_char(dbms_utility.get_time - v_time));  
end;
/

Output:
Original 5721
After Delete 4381
After Rebuild 1384


{correct typo}

[Updated on: Fri, 29 August 2008 05:48]

Report message to a moderator

Re: How to improve select coun(*) from table [message #344292 is a reply to message #344258] Fri, 29 August 2008 05:51 Go to previous messageGo to next message
dwarak.k
Messages: 61
Registered: June 2008
Location: Hyderabad
Member
Ya i think so Smile . Oracle advices to rebuild the index if there is a table data change of 10-15%

Metalink id : 30405.1
Quote:

As a rule of thumb if 10-15% of the table data changes, then you should consider rebuilding the index.



{update}
This reply is for previous message of Mr.JRowbottom (Odd - you'd ...)

[Updated on: Fri, 29 August 2008 05:53]

Report message to a moderator

Re: How to improve select coun(*) from table [message #344301 is a reply to message #344292] Fri, 29 August 2008 05:57 Go to previous messageGo to next message
Michel Cadot
Messages: 68737
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
There are silly things even in Metalink notes.

Regards
Michel
icon5.gif  Re: How to improve select coun(*) from table [message #344304 is a reply to message #344301] Fri, 29 August 2008 06:08 Go to previous messageGo to next message
dwarak.k
Messages: 61
Registered: June 2008
Location: Hyderabad
Member
I agree.
This case where the deleted leaf nodes are just 7827 out of 2307107 (.33%)
Index rebuild was not necessary and I have no clue how there was such a huge performance improvement.

@Michel,JRowbottom just curious
You feel that index rebuild is not necessary even if there is a considerable change in the table data,which might potentially change the index structure.

I was thinking all these time I had to do that!

Thanks in advance.
Dwarak.K
Re: How to improve select coun(*) from table [message #344308 is a reply to message #344304] Fri, 29 August 2008 06:27 Go to previous messageGo to next message
Michel Cadot
Messages: 68737
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
Quote:
You feel that index rebuild is not necessary even if there is a considerable change in the table data

I didn't feel that, it depends on the change, on what you will then do, your queries...
It is almost never necessary to rebuild indexes but there are several (few) exceptions when it is useful.

Regards
Michel

Re: How to improve select coun(*) from table [message #344315 is a reply to message #344304] Fri, 29 August 2008 06:37 Go to previous messageGo to next message
**Snake**
Messages: 47
Registered: December 2005
Location: Italy
Member
This was the situation.

1. The table has about 7500000 records
2. A program delete about 5000000 records
3. The statistics say that table has about 7500000 records
4. I launch command ANALYZE TABLE COMPUTE STATISTICS.
5. The statistics say that table has about 2000000 records
6. The SELECT COUNT(*) statemant run in 40 secs.
7. I launch ...

SELECT name,height,lf_rows,lf_blks,del_lf_rows,distinct_keys,used_space FROM INDEX_STATS;

NAME                               HEIGHT    LF_ROWS    LF_BLKS DEL_LF_ROWS DISTINCT_KEYS USED_SPACE
------------------------------ ---------- ---------- ---------- ----------- ------------- ----------
I_SCCARD_SERIAL_SHP                     4    2307107      61114        7827       2305625   51752799

Elapsed: 00:00:00.02
11:00:21 SQL> SELECT name,height,lf_rows,del_lf_rows,(del_lf_rows/lf_rows)*100 as ratio FROM INDEX_STATS;

NAME                               HEIGHT    LF_ROWS DEL_LF_ROWS      RATIO
------------------------------ ---------- ---------- ----------- ----------
I_SCCARD_SERIAL_SHP                     4    2307107        7827 .339256047


8. I rebuild index online
9. I launch...

analyze index i_sccard_serial_shp validate structure;

Index analyzed.

Elapsed: 00:00:24.46
11:14:31 SQL> SELECT name,height,lf_rows,lf_blks,del_lf_rows,distinct_keys,used_space FROM INDEX_STATS;

NAME                               HEIGHT    LF_ROWS    LF_BLKS DEL_LF_ROWS DISTINCT_KEYS USED_SPACE
------------------------------ ---------- ---------- ---------- ----------- ------------- ----------
I_SCCARD_SERIAL_SHP                     3    2299280      14553           0       2299280   50843165

Elapsed: 00:00:00.02
11:15:12 SQL> SELECT name,height,lf_rows,del_lf_rows,(del_lf_rows/lf_rows)*100 as ratio FROM INDEX_STATS;

NAME                               HEIGHT    LF_ROWS DEL_LF_ROWS      RATIO
------------------------------ ---------- ---------- ----------- ----------
I_SCCARD_SERIAL_SHP                     3    2299280           0          0


9. The SELECT COUNT(*) statement run in 0,5 seconds.



I think if I didn't run the analyze table, at point 7 I had 7500000 of records and not 2307107...

is it correct ???

So in this case I think that rebuild index was necessary.


P.S. Sorry for my english Smile

[Updated on: Fri, 29 August 2008 06:42]

Report message to a moderator

Re: How to improve select coun(*) from table [message #344320 is a reply to message #344315] Fri, 29 August 2008 06:46 Go to previous messageGo to next message
Michel Cadot
Messages: 68737
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
Quote:
So in this case I think that rebuild index was necessary.

Yes and no.
Is the table now static?
Is this query the only one you will ever execute.
If both answers are yes, then yes it was necessary.

Regards
Michel
Re: How to improve select coun(*) from table [message #344321 is a reply to message #344320] Fri, 29 August 2008 06:50 Go to previous messageGo to next message
**Snake**
Messages: 47
Registered: December 2005
Location: Italy
Member
What do you intend for static ?

On this table 1-2 time for years there is a delete of millions of records.
Re: How to improve select coun(*) from table [message #344347 is a reply to message #344321] Fri, 29 August 2008 08:28 Go to previous messageGo to next message
JRowbottom
Messages: 5933
Registered: June 2006
Location: Sunny North Yorkshire, ho...
Senior Member
Dropping the table from 7,500,000 to 2,000,000 records would give you an improvement of about 70%.
I suspect that there was something else happening at the point where the cout took 40 seconds.
On the database on my laptop here, which is running 10 other applications as well as the database, I can do a count(*) on a 70,000,000 row table (unindexed, avy row length 110 bytes) in less time than that.
Re: How to improve select coun(*) from table [message #344406 is a reply to message #344321] Fri, 29 August 2008 13:33 Go to previous messageGo to next message
Michel Cadot
Messages: 68737
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
**Snake** wrote on Fri, 29 August 2008 13:50
What do you intend for static ?

On this table 1-2 time for years there is a delete of millions of records.

Static: no insert, no delete, no update.

It depends which you delete and which one you will insert.

Regards
Michel
Re: How to improve select coun(*) from table [message #344413 is a reply to message #344347] Fri, 29 August 2008 13:52 Go to previous messageGo to next message
Mahesh Rajendran
Messages: 10708
Registered: March 2002
Location: oracleDocoVille
Senior Member
Account Moderator
>>4. I launch command ANALYZE TABLE COMPUTE STATISTICS.
That could be the problem.
May be the OP is collecting stats only for tables and NOT the indexes.
>>8. I rebuild index online
>>9. I launch...

OP is rebuilding the index and analyzing (just validating actually, which will generate certain stats).
The query magically runs faster after Index rebuild (and giving no credit to "analyze").

Re: How to improve select coun(*) from table [message #344450 is a reply to message #344413] Fri, 29 August 2008 16:59 Go to previous messageGo to previous message
**Snake**
Messages: 47
Registered: December 2005
Location: Italy
Member
I think I've solved the problem with the steps I've explained in my previous posts

I repeat... Now "select count(*) from table" statement runs in about 0,5 seconds. Query result is immediate.
Previous Topic: DBMS_JOB
Next Topic: ORA-00937: not a single-group group function
Goto Forum:
  


Current Time: Mon Feb 17 21:21:49 CST 2025