+ Reply to Thread
Results 1 to 4 of 4

Thread: PHP/MySQL Optimizations?

  1. #1
    eikainu is offline x10Hosting Member eikainu is an unknown quantity at this point
    Join Date
    Aug 2009
    Posts
    14

    PHP/MySQL Optimizations?

    Anyone care to share their views on optimization techniques for scripting PHP/MySQL to reduce resource usage? :]

    I know free hosts tend to have a strict policy on the amount of resources you are using, so this would be some ideal information for the average user.

    I've heard about stored procedures but I'm not exactly sure what that is.

  2. #2
    misson is offline x10 Spammer misson is a jewel in the rough
    Join Date
    Mar 2008
    Location
    Libertatia
    Posts
    2,506

    Re: PHP/MySQL Optimizations?

    A good grounding in programming and DB fundamentals is the best way of minimizing resource usage. If you're asking for tutorials and articles (which you'd better be, given the forum), start with § 7.2.1 of the MySQL manual: "Optimizing Queries with EXPLAIN". Also read up on database normalization, though knowing when to denormalize (hint: after normalizing & profiling) is also important.

    As for PHP, study algorithm design (the closest I could come to a tutorial is Paul E. Dunn's overview of algorithm design). An essential part of this is algorithm complexity, including Big-O notation (the primary measure of algorithmic complexity in time & space, that is, how the time & space needs of an algorithm increase as the problem size increases).

    Web searches will turn up plenty of other articles on each of these topics; don't stick to the above links. Be careful of what you find, as some may be out of date or just plain wrong (both more true of DB articles than algorithm design). Note that these topics are complex; algorithms in particular isn't well covered by reading a few tutorials. Books are your best bet, but this isn't the forum for that and the topic has been well-covered elsewhere. There are a few threads in programming help and quite a few questions on Stack Overflow on these topics. I don't recommend asking your question on SO as-is, since it's far too general and related questions have been covered many times before.

    Stored procedures are simply procedures stored on and executed by the SQL server but written by a DB user or admin. You can also have stored functions; together, they are called stored routines. Read the MySQL manual, section 19.2 "Stored Routines" to start.
    Last edited by misson; 06-24-2010 at 12:06 AM.
    Be sure to read all pages linked in this post; they have further information that should prove useful. When asking for help, make sure you follow Eric Raymond's and Jon Skeet's guidelines for prompt, accurate responses. Please answer any questions I ask; they're not rhetorical (probably). Any posted code is intended as illustrative example, rather than a solution to your problem to be copied without alteration. Study it to learn how to write your own solution.
    Misson, not Mission.

  3. #3
    pornophobic's Avatar
    pornophobic is offline x10Hosting Member pornophobic is an unknown quantity at this point
    Join Date
    May 2009
    Location
    Toronto, ON
    Posts
    23

    Re: PHP/MySQL Optimizations?


  4. #4
    Zubair's Avatar
    Zubair is offline x10 Super Spammer Zubair has a reputation beyond reputeZubair has a reputation beyond reputeZubair has a reputation beyond repute
    Join Date
    Jul 2009
    Location
    Pakistan
    Posts
    8,747

    Re: PHP/MySQL Optimizations?

    Tutorial Section is only for posting tutorials. Read Rules before posting.

    ***Moved to Programming Help***
    Zubair Barkat | Level 2 Tech
    █ 888-X10-9668 - zubair[@]x10hosting.com
    x10Hosting - Giving Away Hosting Since 2004

+ Reply to Thread

Similar Threads

  1. Replies: 2
    Last Post: 02-01-2010, 05:45 AM
  2. mySQL error - argument is not a valid MySQL result resource
    By Awesomexr in forum Programming Help
    Replies: 3
    Last Post: 12-20-2009, 04:12 PM
  3. Replies: 3
    Last Post: 02-14-2008, 01:38 PM
  4. Replies: 2
    Last Post: 12-17-2007, 03:00 AM
  5. Replies: 2
    Last Post: 11-20-2007, 11:15 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers