Cached in memory is correct as well as the second
statement will only have to process fewer records if the WITH was done in the
first. Breaking up a SELECT statement into 2 parts may be advantageous,
regardless of caching, if there are multiple ANDed WITH clauses and one or
more of them involve translates. For example:
SSELECT HUGE.ARCHIVE.FILE WITH CUST.ZIP = "12345"
AND WITH PERIOD = "199910"
would be faster as
SELECT HUGE.ARCHIVE.FILE WITH PERIOD =
"199910"
then
SSELECT HUGE.ARCHIVE.FILE WITH CUST.ZIP =
"12345"
assuming that CUST.ZIP is translated and the
PERIOD is a local field. Note the SSELECT in the second statement as
well.
I've often wondered if, when using consecutive
ANDs the filter processor skips the record if the first WITH is false. Why
bother testing the second field if both are ANDed.
my 1 cent.
----- Original Message -----
Sent: Monday, February 02, 2004 11:24
AM
Subject: RE: UDT SELECT
optimization
Chuck,
The order should be immaterial ( it is on every other
database I can think of ).
Just be aware that if you test it by issuing the
commands one after the other, the second may may complete quicker, simply
because the file may be cached in memory.
Brian Leach
Does anyone know whether one of these two
statements is faster?
SELECT FILE BY SOME.DATE WITH SOME.FIELD =
"XXX"
-or-
SELECT FILE WITH SOME.FIELD = "XXX" BY
SOME.DATE
Does the parser / optimizer (if there is one) do
the filter portion of the statement first regardless of the order that you
build it in or does it do things EXACTLY in the order that you enter them on
the command line?
-Chuck
________________________________________________________________________
This
email was checked by MessageLabs SkyScan before entering
Microgen.
________________________________________________________________________
This
email was checked on leaving Microgen for viruses, similar
malicious code
and inappropriate content by MessageLabs
SkyScan.
DISCLAIMER
This email and any attachments are
confidential and may also be
privileged.
If you are not the named
recipient, please notify the sender
immediately and do not disclose the
contents to any other
person, use it for any purpose, or store or copy
the information.
In the event of any technical difficulty with this
email, please
contact the sender or
[EMAIL PROTECTED]
Microgen Information Management
Solutions
http://www.microgen.co.uk
_______________________________________________
u2-users mailing
list
[EMAIL PROTECTED]
http://www.oliver.com/mailman/listinfo/u2-users