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


Groups > comp.lang.php > #11736 > unrolled thread

Mysqli or PDO Persistent prepared statements

Started byRam <ramprasad.ap@gmail.com>
First post2013-11-06 01:18 -0800
Last post2013-11-06 21:04 +0100
Articles 7 — 7 participants

Back to article view | Back to comp.lang.php


Contents

  Mysqli or PDO Persistent prepared statements Ram <ramprasad.ap@gmail.com> - 2013-11-06 01:18 -0800
    Re: Mysqli or PDO Persistent prepared statements The Natural Philosopher <tnp@invalid.invalid> - 2013-11-06 09:46 +0000
    Re: Mysqli or PDO Persistent prepared statements Jerry Stuckle <jstucklex@attglobal.net> - 2013-11-06 05:45 -0500
    Re: Mysqli or PDO Persistent prepared statements Tobiah <toby@tobiah.org> - 2013-11-06 09:41 -0800
    Re: Mysqli or PDO Persistent prepared statements Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-11-06 20:25 +0100
      Re: Mysqli or PDO Persistent prepared statements "Beauregard T. Shagnasty" <a.nony.mous@example.invalid> - 2013-11-06 22:06 +0000
    Re: Mysqli or PDO Persistent prepared statements Arno Welzel <usenet@arnowelzel.de> - 2013-11-06 21:04 +0100

#11736 — Mysqli or PDO Persistent prepared statements

FromRam <ramprasad.ap@gmail.com>
Date2013-11-06 01:18 -0800
SubjectMysqli or PDO Persistent prepared statements
Message-ID<fab413de-c3eb-43c9-87e0-dc725e1cb5b6@googlegroups.com>
I have a very high traffic server. Getting upto a million hits per day. 
These are basically tracking URLs that log the hits and redirect to the relevant page

The current script using php mysql is very slow. I want to switch to mysqli. 
Are there any basic guidelines for shifting to mysqli 
Can I use a persistent prepared statements across different calls to the web server ? 

Thanks
Ram
Spammers please visit http://pragatee.com

[toc] | [next] | [standalone]


#11737

FromThe Natural Philosopher <tnp@invalid.invalid>
Date2013-11-06 09:46 +0000
Message-ID<l5d34u$ea1$2@news.albasani.net>
In reply to#11736
On 06/11/13 09:18, Ram wrote:
> I have a very high traffic server. Getting upto a million hits per day.
> These are basically tracking URLs that log the hits and redirect to the relevant page
>
> The current script using php mysql is very slow. I want to switch to mysqli.

I doubt that will make any difference

> Are there any basic guidelines for shifting to mysqli
> Can I use a persistent prepared statements across different calls to the web server ?
>
> Thanks
> Ram
> Spammers please visit http://pragatee.com
>


-- 
Ineptocracy

(in-ep-toc’-ra-cy) – a system of government where the least capable to 
lead are elected by the least capable of producing, and where the 
members of society least likely to sustain themselves or succeed, are 
rewarded with goods and services paid for by the confiscated wealth of a 
diminishing number of producers.

[toc] | [prev] | [next] | [standalone]


#11738

FromJerry Stuckle <jstucklex@attglobal.net>
Date2013-11-06 05:45 -0500
Message-ID<l5d6l5$9v6$1@dont-email.me>
In reply to#11736
On 11/6/2013 4:18 AM, Ram wrote:
> I have a very high traffic server. Getting upto a million hits per day.
> These are basically tracking URLs that log the hits and redirect to the relevant page
>
> The current script using php mysql is very slow. I want to switch to mysqli.
> Are there any basic guidelines for shifting to mysqli
> Can I use a persistent prepared statements across different calls to the web server ?
>
> Thanks
> Ram
> Spammers please visit http://pragatee.com
>

You're not going to see any significant gain by switching from 
mysql_xxx() to mysqli_xxx().  Both use similar interfaces, and the 
overhead is about the same.

Prepared statements are good, but they will slow you down even more as 
each one requires multiple calls to the database code.  MySQL has no 
such thing as "persistent prepared statements" (neither does anyone else 
AFAIK).

Have you determined your MySQL calls are the problem?  Or are you 
shooting in the dark?

-- 
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

[toc] | [prev] | [next] | [standalone]


#11744

FromTobiah <toby@tobiah.org>
Date2013-11-06 09:41 -0800
Message-ID<9bveu.260902$Oj5.216717@fx02.iad>
In reply to#11736
> The current script using php mysql is very slow.

Are you good at database administration?  Most of the time it's a lack of
indexing in the table definitions.  Next up is 'loose' joins that are not
completely constrained between tables.  You don't want to see 'Copying to
Temp table' in the process list.



[toc] | [prev] | [next] | [standalone]


#11746

FromThomas 'PointedEars' Lahn <PointedEars@web.de>
Date2013-11-06 20:25 +0100
Message-ID<1860437.5WiKnBterZ@PointedEars.de>
In reply to#11736
Ram wrote:

> The current script using php mysql is very slow. I want to switch to
> mysqli. 

With obsolete code like that, make sure that this is not the only reason for 
reduced effiency.

> I want to switch to mysqli.

Good Idea.  Also consider PDO_MySQL; PDO has the simpler interface and is 
database-agnostic.

> Are there any basic guidelines for shifting to mysqli

Yes.

> Can I use a persistent prepared statements across different calls to the
> web server ?

No.
 
> Thanks

You're welcome.

> Ram

Belongs beneath “-- ” if there is enough room.

> Spammers please visit http://pragatee.com

You do not seriously expect spammers to read the body of your messages, do 
you?


PointedEars
-- 
Danny Goodman's books are out of date and teach practices that are
positively harmful for cross-browser scripting.
  -- Richard Cornford, cljs, <cife6q$253$1$8300dec7@news.demon.co.uk> (2004)

[toc] | [prev] | [next] | [standalone]


#11749

From"Beauregard T. Shagnasty" <a.nony.mous@example.invalid>
Date2013-11-06 22:06 +0000
Message-ID<l5eeg9$s3t$1@dont-email.me>
In reply to#11746
Thomas 'PointedHead' Lahn wrote:

> Ram wrote:
>> Ram
> 
> Belongs beneath “-- ” if there is enough room.
> 
> PointedEars

Belongs beneath “-- ” if there is enough room.

-- 
   -bts
   -Tit for Tat

[toc] | [prev] | [next] | [standalone]


#11747

FromArno Welzel <usenet@arnowelzel.de>
Date2013-11-06 21:04 +0100
Message-ID<527AA0B0.3010001@arnowelzel.de>
In reply to#11736
Ram, 2013-11-06 10:18:

> I have a very high traffic server. Getting upto a million hits per day. 
> These are basically tracking URLs that log the hits and redirect to the relevant page
> 
> The current script using php mysql is very slow. I want to switch to mysqli. 
> Are there any basic guidelines for shifting to mysqli 
> Can I use a persistent prepared statements across different calls to the web server ? 

Besides all other tips: Consider using a byte code cache (XCache, APC
etc.) as well and also check if not the database itself is the bottleneck.

A million hits per day may be up to 10 hits per second - and if really
*every* hit results in a database operation it may not just the small
difference between mysql, msqli or PDO which is important here.

Also check your application in a test environment and load/stress
testing tools (ApacheBench, Gatling Curl-loader etc.) to see how your
scripts perform.

Maybe using other techniques may be better - e.g. using a kind of
"cache" for the redirects which can be loaded and used without any
database access at all. If you need to track hits as well it may be
easier to keep process access logs in text form and process them using a
cron job in background and maybe even on another server.


-- 
Arno Welzel
http://arnowelzel.de
http://de-rec-fahrrad.de

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.php


csiph-web