At 21:56 -0400 25/4/01, Sterin, Ilya wrote:
>Why would (select * from foo) take up lost of resources? Won't it just
>place the cursor at the first row and only return when rows are fetched?
Speaking for Oracle, as soon as the statement is executed (and before
any fetch) Oracle will execute the statement - and that means
performing the full table scan(s) or index scan(s) necessary to
fulfill the statement.
In fact, any transactional (and therefore relational) database will
have to do the same. The point in time for data consistency is the
instant of execution, and for non-Oracle databases, locks will be
applied at the time of the execution.
It is bad practice to execute queries of the form often mentioned in
this thread with no predicate. The waste of resource could be very
significant (on some of our databases possibly several hours). If you
need to know if a table exists, query the SQL standard data
dictionary: select table_name from user_tables where table_name =
'TABLE_NAME';
Regards
Paul Miller
--
-
Carib Data Limited
<mailto:[EMAIL PROTECTED]>
<http://www.caribdata.co.uk>