Re: Some help with Optimization
Re: Some help with Optimization
- Subject: Re: Some help with Optimization
- From: Ken Anderson <email@hidden>
- Date: Fri, 10 Feb 2006 10:36:12 -0500
Arturo,
This is not my experience. For certain, if you check the query plan
on Sybase, it will table scan. Again, other databases may be
different, but the only way to be sure is to take the query WO would
run, and check the query plan.
Ken
On Feb 10, 2006, at 10:32 AM, Arturo Perez wrote:
Ken Anderson wrote:
I wrote a lengthly post regarding this not too long ago...
The bottom line is, I have not met a SQL optimizer that
understands WO's idea of how to lock optimistically. As far as
it's concerned, why would you put 20 fields in a where clause if
you already know that one of them is a unique primary key? So, it
will run the query through many stages of optimization, and often
determine that there's no good index to help it (because it thinks
it's looking for a result set larger than 1) and it will resort to
a table scan. Yes, the name implies exactly what it does...
I do not believe that's where the cost comes from. As long as you
have unique primary keys the database knows it will only pull one
row. I think the hit comes from comparing all the additional
fields. For example, the typical admonishment about not using
BLOBs as a optimistic locking key stems from the fact that binary
compares of hundreds or thousands of bytes is not cheap. Add in
any necessary datatype conversions etc and the cost could become
quite high.
So, you pull the row almost instantly and then do strcmp(field1,
lockkey1) && strcmp(field2, lockkey2) && strcmp(field3, lockkey3)
&& ...
-arturo
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden