Results 1 to 5 of 5
  1. #1
    Join Date
    Apr 2003
    Posts
    1

    Unanswered: mysql - client vs. .mysql_query execution time .

    mysql - client vs. .mysql_query execution time ..

    The query used is below:

    $sql_query="SELECT doc_plata.data,doc_plata.data_efectiva,doc_plata.i d,doc_plata.nr,doc_plata.nr_document,doc_plata.id_ rol,contribuabil.nume,contribuabil.prenume,contrib uabil.cnp,doc_plata.suma,doc_plata.activ FROM (doc_plata LEFT JOIN borderou ON doc_plata.id_borderou=borderou.id) INNER JOIN contribuabil ON doc_plata.id_contribuabil=contribuabil.id WHERE doc_plata.id_borderou='$this->id_borderou' AND doc_plata.id_mod_plata='$this->id_mod_plata' AND borderou.id_casier='$this->id_casier' ORDER BY data_efectiva";


    Execution time in mysqlclient :
    280 rows in set (0.21 sec)

    Execution time in mysql_query .php script:
    Document: Done (31 secs !!!! - I can eat a sandwich in between ..)

    I tried the query directly to the machine where php-mysql is installed (so It's not about network load)

    It blows me away ( I need all records in one page - can't use LIMIT 0,x)

    I appreciate any help

    Best regards

  2. #2
    Join Date
    Apr 2003
    Posts
    9
    Let's see the script. There could be an isue there. Have you considered timing portions of the script? Also, are you making straight calls to the db (mysql_query() for example) or using an abstraction layer? If so, what is it? Be mindfull: dbx is around 50 to 55% percent slower during the query phase.

    Cheers,
    BDKR

  3. #3
    Join Date
    Feb 2002
    Posts
    20
    BDKR,

    You mention that a dbx (you mean a db extraction layer, right?) is slower by 50% or more. I am curious, how do you know this? As well, we shouldn't try to mislead the author of this post. If the dbx is slower it certainly would not slow down their script to 31 sec. I personally find using a dbx much more straightforward and it keeps my code much more clean. Just curious, why do you think people use them? Is it for portability?

    Piet
    Last edited by piet; 04-10-03 at 12:59.

  4. #4
    Join Date
    Apr 2003
    Posts
    9
    Originally posted by piet
    BDKR,
    You mention that a dbx (you mean a db extraction layer, right?) is slower by 50% or more.
    I don't mean a, as in any db abstraction layer. I"m talking about the dbx functions that are an extension in PHP.

    Originally posted by piet
    I am curious, how do you know this?
    It's called benchmarking. However, mine aren't posted. I did speak about it at php.weblogs.com.

    http://php.weblogs.com/discuss/msgReader$2336

    As you can see, the author of the site found that particular extension to slower than just straight MySQL calls (as an example) too. This was suprising to both of us as dbx is a engine level abstraction layer. It's written in C, not PHP.

    Originally posted by piet
    As well, we shouldn't try to mislead the author of this post. If the dbx is slower it certainly would not slow down their script to 31 sec.
    No effort to mislead. Just trying to bring up some points and things to be aware of that could be part of the problem. An abstraction layer is ALLWAYS going to add overhead and allmost always will result in a increase in execution time. This is a constant. That said, how much overhead or slowdown occurs is a question of how well the abstraction layer is written.

    Originally posted by piet
    I personally find using a dbx much more straightforward and it keeps my code much more clean. Just curious, why do you think people use them? Is it for portability?

    Piet
    The truth about the above is that you wouldn't have asked if you knew what the dbx extensions are.

    I know what abstraction layers are and use and have used. On one of my sites, I use the Eclipse Library (this is still PHP) . I also have one of my own called Small Unit Raid which is based on the idea of using something akin to structures in C.

    Cheers,
    BDKR

  5. #5
    Join Date
    Feb 2002
    Posts
    20
    BDKR,

    Abstraction...thanks for the correction (just a little spacey lately). Otherwise, thanks for the info.

    Piet

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •