Menu

#87 MySQL Prepared Statements

ver devel
open
modules (140)
5
2007-10-05
2007-05-12
No

Hi

file attached introduce MySQL Prepared Statemets API using in mysql module.
"Prepared execution is faster than direct execution for statements executed more than once, primarily because the query is parsed only once."
So I hope it can help OpenSER to be more quickly on SELECT/INSERT/UPDATE when it using (MySQL) DB backend.

To compile this API support you can define new make variable MYSQL_USE_PREPARED_STMT (or simply add it into Makefile) and run make/gmake.

This patch build for 1.2.0
I test it on my openser-1.2.0 and it works fine but more tests needed.
I will try to make code clear ASAP.

Thanks.

Discussion

  • Victor Gamov

    Victor Gamov - 2007-05-12

    Logged In: YES
    user_id=1625470
    Originator: YES

    File Added: mysql_ps-patch.tgz

     
  • Victor Gamov

    Victor Gamov - 2007-05-17

    Logged In: YES
    user_id=1625470
    Originator: YES

    File Added: mysql_ps-patch.tgz

     
  • Victor Gamov

    Victor Gamov - 2007-05-17

    bug with db_mysql_raw_query() fixed

     
  • Henning Westerholt

    Logged In: YES
    user_id=337916
    Originator: NO

    Hello Victor,

    according to the mysql documentation, prepared statements are available starting from version 4.1. This should be ok, as most of the distribution ships at least 4.1 now. Are there any stabilty problems with 4.1 with this feature? What version do you use?

    I'll take next week a closer look to your patch.

    Henning

     
  • Victor Gamov

    Victor Gamov - 2007-05-18

    Logged In: YES
    user_id=1625470
    Originator: YES

    Hi Henning

    I devel and test this patch on mysql-server-4.1.3
    On next week I'll try to test it on 5.1.16

     
  • Henning Westerholt

    • assigned_to: nobody --> henningw
     
  • Henning Westerholt

    Logged In: YES
    user_id=337916
    Originator: NO

    The patch could not be applied anymore to the trunk.

    Cheers,

    Henning

     
  • Henning Westerholt

    • milestone: 699849 --> ver devel
     
  • Nobody/Anonymous

    Hi Henning,

    any news on this feature, it seems to be already implemented in OpenSIPS,
    why not in Kamailio?

     
  • Henning Westerholt

    Hi,

    there is already a mature prepared statement implementation in the sip-router project core. We decided to use this instead of implementing our own solution. In my experience nowadays most of the time in the DB is spend in actually searching and loading the data from the database, and not in the parsing of the statements. So the expected performance benefits don't justify the regressions and bugs that a complete rework of our database core bring with it, in my opinion.

    In the sip-router project are the mysql and postgres drivers already converted, and support both interfaces. So when our modules are imported in this tree, we can start to convert them to use prepared statements. If you take a look at the 'kamailio-3.0' branch, here its already possible to experiment with the new interface, and convert some modules for testing.

     

Log in to post a comment.