in reply to Slow response on DBI MySQL query
"select Country from GeoIP where ('$lip' > Start_int) and ('$lip' < End_int) limit 1");
Aside from adding insecurity with dynamic SQL, there's little benefit from possible RDBMS caching. That is, preparing a query that uses palceholders allows the RDBMS to create a PLAN that (it thinks) is best for varying arguments. Also, rerunning the query does not require a new prepare.
And, large loads can be done with a bulk collect.
'$lip' > Start_int) and ('$lip' < End_int)
BETWEEN is inclusive. So a BETWEEN b and c means a >= b AND a <= c. So, there's a difference between (no pun intended) the two statements.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Slow response on DBI MySQL query
by Fortificus (Novice) on Mar 24, 2015 at 14:06 UTC | |
by chacham (Prior) on Mar 24, 2015 at 14:38 UTC | |
by Fortificus (Novice) on Mar 24, 2015 at 14:49 UTC | |
by chacham (Prior) on Mar 24, 2015 at 15:28 UTC |