Re: str_replace does not like empty quotes [message #186299 is a reply to message #186294] |
Mon, 23 June 2014 13:07 |
Jerry Stuckle
Messages: 2598 Registered: September 2010
Karma:
|
Senior Member |
|
|
On 6/23/2014 2:33 AM, Geoff Muldoon wrote:
> jstucklex(at)attglobal(dot)net says...
>>
>> On 6/22/2014 7:20 PM, Geoff Muldoon wrote:
>>> jstucklex(at)attglobal(dot)net says...
>
>>> Hmm, I've never really found any signifcant down-side to using bind
>>> variables if they are used corrctly, so I'd appreciate any links you
>>> might have.
>
>> Performance, for one. Bound values require at least one extra call to
>> the libraries (for the PREPARE).
>
>> The extra processing can be excessive in a busy site. Of course, if
>> you're only getting 100 hits/day, it's not a problem.
>
> Yes, the first usage of a prepared statement will always require that
> extra call, and if it is a query that is unlikely to be run again before
> it is flushed from the cache, it will require this call again each time.
>
> However, *particularly if it IS a busy site* and it is a query that is
> likely to be executed with a very high regularity (e.g.: "select <fixed
> list of order details columns> from order_details_table where order_id =
> :<bound variable>") then the benefit of SQL execution plan caching and
> soft instead of hard parsing will usually *massively* outweigh that
> possible initial overhead.
>
> High-volume sites are MORE likely than toy ones to benefit from bind
> variables.
>
> GM
>
If it's a busy site, then there will be a lot more calls to MySQL - and
chances are the cache will be filled (and flushed) before the prepared
statement is run again. It's not how long since the query has run -
it's how many other queries have been run. Remember it isn't just one
query being run on a site - a large site will have hundreds (or more)
different queries.
And it will still require a call each time, because you never know
whether it has been flushed or not.
Additionally, you ignore the fact additional calls need to be made to
bind numeric values - calls which are not required when not using bind
values.
Have you ever worked on a high-active site? Say 1K hits/second or more?
And have you ever profiled bind values on such a site? I have. Bind
values are significantly slower.
--
==================
Remove the "x" from my email address
Jerry Stuckle
jstucklex(at)attglobal(dot)net
==================
|
|
|