Re: Percentages in SQL?

From: Kevin Neel <k-neel_at_nwu.edu>
Date: 27 Jan 1994 21:58:01 GMT
Message-ID: <2i9dd9$1j2_at_anaxagoras.ils.nwu.edu>


In article <CK8zq2.E0z_at_vtm.be> The Administrator, gerrit_at_vtm.be writes:
>In oracle v7 there is a table sys.tab$ which contains the number of rows
 in a
>specific table. This table is also appearing as a part of the view
 USER_TABLES
>and of course DBA_TABLES. Of course this value is incorrect if you don't
 do a
>analyze table compute statistics...

I don't think you really want to do this (analyze tables). For one, it is bound to be costly. For another, it will (probably) cause your transaction to commit. For yet another, even if you were to do the ANALYZE TABLE, you still can't guarantee that the number of rows is correct; someone else could sneak a transaction in on you (you'd lose all locks during the commit).

Frankly, you'd be better off doing two separate SELECTs (one doing locking) than something like this. Either the view or clever GROUP BYs are best solutions. Received on Thu Jan 27 1994 - 22:58:01 CET

Original text of this message