Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Select count(*) in Oracle and MySQL
Mladen Gogala wrote:
> On Wed, 19 Sep 2007 11:40:21 -0700, Occidental wrote:
>
>> I have a table with about 250M rows, implemented in both Oracle and >> MySQL. >> Select count(*) in MySQL is effectively instantaneous, presumably >> because it accesses some internal count that is maintained by the DBMS. >> The same query in Oracle takes about 6 minutes, pretty obviously becasue >> it counts rows. The Oracle table should have been set up with a primary >> key, but wasn't. The MySQL table has no primary key either. Any >> comments?
The OP doesn't even need to work that hard to duplicate mySQL.
SELECT num_rows FROM user_tables WHERE table_name =
is a close approximation of instantaneous.
-- Daniel A. Morgan University of Washington damorgan_at_x.washington.edu (replace x with u to respond) Puget Sound Oracle Users Group www.psoug.orgReceived on Mon Oct 08 2007 - 11:49:23 CDT
![]() |
![]() |