Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: select/fetch which one cost more?

Re: select/fetch which one cost more?

From: Thomas Kyte <tkyte_at_us.oracle.com>
Date: Thu, 04 Jun 1998 14:05:46 GMT
Message-ID: <3578a7ee.1410347@192.86.155.100>


A copy of this was sent to Jinqlih Sang <csang_at_home.com> (if that email address didn't require changing) On Thu, 04 Jun 1998 09:56:03 GMT, you wrote:

>In pro*c (or say database server), which one is more
>time consuming? Select (executing a query) or Fetch
>(move data via network from database server to client)?

neither, both, select only, fetch only.... it (like everything else) depends.

Lets say you have a 1,000,000 row table and execute:

select count(*) from T;

the select phase (opening the cursor) will consume many more resources then the fetch phase will. You are processing 1million records in the open but only sending 1 row in the fetch phase.

OTOH, you issue: select * from T

Now we have reversed it. The select (open) phase will take virtually no resources (its a simple full scan, no sorts, no aggregates, etc) but the fetch phase will be hitting your network hard.  

Thomas Kyte
tkyte_at_us.oracle.com
Oracle Government
Herndon VA  

http://govt.us.oracle.com/ -- downloadable utilities  



Opinions are mine and do not necessarily reflect those of Oracle Corporation  

Anti-Anti Spam Msg: if you want an answer emailed to you, you have to make it easy to get email to you. Any bounced email will be treated the same way i treat SPAM-- I delete it. Received on Thu Jun 04 1998 - 09:05:46 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US