Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #14013

Re: str_replace does not like empty quotes

From Jerry Stuckle <jstucklex@attglobal.net>
Newsgroups comp.lang.php
Subject Re: str_replace does not like empty quotes
Date 2014-06-23 09:07 -0400
Organization A noiseless patient Spider
Message-ID <lo98qu$89n$1@dont-email.me> (permalink)
References (3 earlier) <MPG.2e10c8c57f2c8c33cb@news.albasani.net> <lo56pm$lmb$1@dont-email.me> <MPG.2e120fe5a954aa80cc@news.albasani.net> <lo7t9d$erm$1@dont-email.me> <MPG.2e1275462354b05cce@news.albasani.net>

Show all headers | View raw


On 6/23/2014 2:33 AM, Geoff Muldoon wrote:
> jstucklex@attglobal.net says...
>>
>> On 6/22/2014 7:20 PM, Geoff Muldoon wrote:
>>> jstucklex@attglobal.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@attglobal.net
==================

Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

str_replace does not like empty quotes richard <noreply@example.com> - 2014-06-19 19:33 -0400
  Re: str_replace does not like empty quotes Jerry Stuckle <jstucklex@attglobal.net> - 2014-06-19 20:09 -0400
  Re: str_replace does not like empty quotes Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2014-06-19 20:11 -0400
    Re: str_replace does not like empty quotes Jerry Stuckle <jstucklex@attglobal.net> - 2014-06-19 20:55 -0400
    Re: str_replace does not like empty quotes Doug Miller <doug_at_milmac_dot_com@example.com> - 2014-06-20 03:23 +0000
    Re: str_replace does not like empty quotes Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-06-20 09:31 +0200
  Re: str_replace does not like empty quotes Arno Welzel <usenet@arnowelzel.de> - 2014-06-20 03:19 +0200
    Re: str_replace does not like empty quotes Arno Welzel <usenet@arnowelzel.de> - 2014-06-20 03:21 +0200
      Re: str_replace does not like empty quotes Jerry Stuckle <jstucklex@attglobal.net> - 2014-06-19 21:33 -0400
        Re: str_replace does not like empty quotes Arno Welzel <usenet@arnowelzel.de> - 2014-06-20 04:06 +0200
          Re: str_replace does not like empty quotes Jerry Stuckle <jstucklex@attglobal.net> - 2014-06-19 22:26 -0400
    Re: str_replace does not like empty quotes richard <noreply@example.com> - 2014-06-19 22:13 -0400
      Re: str_replace does not like empty quotes Doug Miller <doug_at_milmac_dot_com@example.com> - 2014-06-20 03:26 +0000
      Re: str_replace does not like empty quotes Arno Welzel <usenet@arnowelzel.de> - 2014-06-20 11:01 +0200
        Re: str_replace does not like empty quotes Arno Welzel <usenet@arnowelzel.de> - 2014-06-20 11:02 +0200
          Re: str_replace does not like empty quotes Denis McMahon <denismfmcmahon@gmail.com> - 2014-06-20 15:38 +0000
      Re: str_replace does not like empty quotes Denis McMahon <denismfmcmahon@gmail.com> - 2014-06-20 15:32 +0000
  Re: str_replace does not like empty quotes Denis McMahon <denismfmcmahon@gmail.com> - 2014-06-20 01:59 +0000
  Re: str_replace does not like empty quotes Doug Miller <doug_at_milmac_dot_com@example.com> - 2014-06-20 03:25 +0000
  Re: str_replace does not like empty quotes Geoff Muldoon <geoff.muldoon@trap.gmail.com> - 2014-06-20 16:10 +1000
    Re: str_replace does not like empty quotes Christoph Michael Becker <cmbecker69@arcor.de> - 2014-06-20 13:48 +0200
      Re: str_replace does not like empty quotes Denis McMahon <denismfmcmahon@gmail.com> - 2014-06-20 15:40 +0000
      Re: str_replace does not like empty quotes Geoff Muldoon <geoff.muldoon@trap.gmail.com> - 2014-06-22 10:05 +1000
        Re: str_replace does not like empty quotes Jerry Stuckle <jstucklex@attglobal.net> - 2014-06-21 20:08 -0400
          Re: str_replace does not like empty quotes Geoff Muldoon <geoff.muldoon@trap.gmail.com> - 2014-06-23 09:20 +1000
            Re: str_replace does not like empty quotes Jerry Stuckle <jstucklex@attglobal.net> - 2014-06-22 20:44 -0400
              Re: str_replace does not like empty quotes Geoff Muldoon <geoff.muldoon@trap.gmail.com> - 2014-06-23 16:33 +1000
                Re: str_replace does not like empty quotes Jerry Stuckle <jstucklex@attglobal.net> - 2014-06-23 09:07 -0400
                Re: str_replace does not like empty quotes Geoff Muldoon <geoff.muldoon@trap.gmail.com> - 2014-06-24 12:34 +1000
                Re: str_replace does not like empty quotes Jerry Stuckle <jstucklex@attglobal.net> - 2014-06-23 23:07 -0400
                Re: str_replace does not like empty quotes Doug Miller <doug_at_milmac_dot_com@example.com> - 2014-06-24 11:12 +0000
                Re: str_replace does not like empty quotes Jerry Stuckle <jstucklex@attglobal.net> - 2014-06-24 08:01 -0400
  Re: str_replace does not like empty quotes Olaf Schmitt <thesys@gmx.de> - 2014-06-24 08:13 +0200
    Re: str_replace does not like empty quotes Arno Welzel <usenet@arnowelzel.de> - 2014-06-24 10:44 +0200
      Re: str_replace does not like empty quotes Denis McMahon <denismfmcmahon@gmail.com> - 2014-06-24 18:48 +0000
        Re: str_replace does not like empty quotes Christoph Michael Becker <cmbecker69@arcor.de> - 2014-06-24 21:53 +0200
          Re: str_replace does not like empty quotes Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-06-24 22:08 +0200

csiph-web