Orlando Wrote: This may be true, but as I understand it (vaguely), in
Oracle, when you do
the execute it (by default) runs the query through and fetches all the rows.
In Oracle, the $sth->execute() builds the cursor and waits for the program
to start fetching records. The hints don't change this behavior, just the
access plan.
ALL_ROWS Hint
The ALL_ROWS hint explicitly chooses the cost-based approach to optimize a
statement block with a goal of best throughput (that is, minimum total
resource consumption).
FIRST_ROWS Hint
The FIRST_ROWS hint explicitly chooses the cost-based approach to optimize a
statement block with a goal of best response time (minimum resource usage to
return first row).
This hint causes the optimizer to make the following choices:
If an index scan is available, then the optimizer may choose it over a full
table scan.
If an index scan is available, then the optimizer may choose a nested loops
join over a sort-merge join whenever the associated table is the potential
inner table of the nested loops.
If an index scan is made available by an ORDER BY clause, then the optimizer
may choose it to avoid a sort operation.
-----Original Message-----
From: Orlando Andico [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, June 26, 2001 10:51 AM
To: Sterin, Ilya
Cc: 'Philip Mak '; 'Steven Lembark '; ''[EMAIL PROTECTED] ' '
Subject: RE: Shorthand for $dbh->prepare and $sth->execute?
On Tue, 26 Jun 2001, Sterin, Ilya wrote:
..
> Right. The first will fetch all rows, where the second can be stopped at
> any time.
..
> versus:
>
> $sth = $dbh->prepare("SELECT ...");
> $sth->execute;
> while ($row = $sth->fetchrow_hashref) {
> do something with $row
> }
This may be true, but as I understand it (vaguely), in Oracle, when you do
the execute it (by default) runs the query through and fetches all the
rows. Although this behavior can be changed using an optimizer hint
("return rows as quickly as possible") which I forgot right now..
I'm not sure if this is correct, btw. It's just that I've noticed when you
do large SELECTs in Oracle, the execute takes forever. When the execute
completes, a torrent of data comes in. So my conclusion that Oracle
executes the whole query first..
--
Orlando Andico <[EMAIL PROTECTED]>
Mosaic Communications, Inc.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GE d(-) s: a-25 C++++ UBLSI++++$ P+++ L+++>++++ E- W++ N(+)
o K? w O-- M- !V PS(++) PE- Y PGP-- t(+)@ 5(+) X++@ R(+) tv@
b++ DI++ G e++@ h--(*) r% y+
------END GEEK CODE BLOCK------