in reply to same query, different execution, different performance
Prepare can be a very expensive critter and the DB might do a lot of thinking about what indicies, etc to use. In the first case, the DB knows that the string is going to start with "abc" at the time that the prepare method is called. That is a huge hint that it can take advantage of.
In the second case, the DB doesn't know that in key bit of info advance, so it is a lot more "stupid" about how it goes about the "execute" part. So the basic difference is that "more thinking" went into the first prepare vs the second prepare because the DB knew more about what you were going to do.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: same query, different execution, different performance
by punkish (Priest) on Feb 14, 2012 at 02:37 UTC | |
by Marshall (Canon) on Feb 14, 2012 at 04:33 UTC | |
Re^2: same query, different execution, different performance
by Anonymous Monk on Feb 14, 2012 at 01:40 UTC | |
by Marshall (Canon) on Feb 14, 2012 at 01:58 UTC | |
by Anonymous Monk on Feb 14, 2012 at 10:20 UTC |