Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Re^2: same query, different execution, different performance

by punkish (Priest)
on Feb 14, 2012 at 02:37 UTC ( #953589=note: print w/replies, xml ) Need Help??

in reply to Re: same query, different execution, different performance
in thread same query, different execution, different performance

Thanks Marshall. Makes a lot of sense.

when small people start casting long shadows, it is time to go to bed
  • Comment on Re^2: same query, different execution, different performance

Replies are listed 'Best First'.
Re^3: same query, different execution, different performance
by Marshall (Abbot) on Feb 14, 2012 at 04:33 UTC
    Another idea occurred to me - don't know if it would work or not - but an experiment should be easy for you...

    If you are always adding this % wildcard at the end, what happens if you put that wildcard into the version 2 prepare? i.e. LIKE ?% instead of LIKE ? In this case you would just put in the raw $q "abc" instead of "abc%". In my simple "untested code" brain, that might trigger the DB to use the index, knowing that it will start out the search with a constant term that you provide.

    I personally do not know the answer. But on the surface it sounds plausible. Anyway I think it would be fun the hear the results of that test. This is likely to be DB specific, but never-the-less interesting. I think the chance of success is low, but this critter may be smarter than we think.

    I am working on some complicated approximate matches in SQLite. This may not apply in your case, but consider that if case is not an issue: ABC% must all fall between x >="ABC" and x<"ABD" in a string comparison sense depending upon how the DB is indexed and other confounding factors...

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://953589]
[RonW]: Sounds like some system my employer has "It does exactly what we need it to do and can't afford to risk anything we can't prove is 100% compatible"
[marto]: choroba sounds interesting
[RonW]: james28909 Why not write a Perl program to do the task?
[choroba]: RonW Yes, but then, one day, they needed to switch from FTP to SFTP, and... but I can't give the whole talk away here :)
[RonW]: Tunnel FTP through stunnel?

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (10)
As of 2017-05-22 21:41 GMT
Find Nodes?
    Voting Booth?