Hello,
the sqlops module only support “standard SQL” queries from the configuration. And practically speaking, if you are executing your query against a remote server, the network overhead will probably substancially higher
than parsing the SQL statement on the server. So, I do not think there is actually a big benefit for using this.
If you need the last bit of performance, you could always implement a C module and implement it there. From my experience you will gain most with statement batching, especially for write operations.
Cheers,
Henning
From: sr-users <sr-users-bounces@lists.kamailio.org>
On Behalf Of Chaigneau, Nicolas
Sent: Tuesday, April 19, 2022 6:25 PM
To: Kamailio (SER) - Users Mailing List <sr-users@lists.kamailio.org>
Subject: Re: [SR-Users] PostgreSQL - module sqlops - working with prepared statements ?
Hello,
Trying again, in case this got unnoticed the first time.
I hope that by doing so I’m not breaching the rules of the mailing list.
If nobody answers, then I’ll conclude that nobody knows about that, and shall not insist anymore. :)
Regards,
Nicolas.
De : sr-users <sr-users-bounces@lists.kamailio.org>
De la part de Chaigneau, Nicolas
Envoyé : vendredi 8 avril 2022 17:01
À : sr-users@lists.kamailio.org
Objet : [SR-Users] PostgreSQL - module sqlops - working with prepared statements ?
Hello,
I’m using sql_xquery from sqlops module to execute requests on a PostgreSQL database.
This work fine.
Now, for performance reasons, I would like to use prepared statements.
I’m wondering if this is possible using sql_xquery. I’ve looked at the code and documentation, it seems it is not supported.
Can you confirm ?
If not possible with sql_xquery, is it possible with another existing function ?
In the code, I’ve searched for « PQprepare » / « PQexecPrepared ».
These can be found only in « modules/db_postgres/pg_cmd.c », in function « pg_cmd_exec » which is exported from « modules/db_postgres/pg_mod.c » (see below).
I have no idea how to use these though… :/
Any ideas ?
/*
* Postgres module interface
*/
static cmd_export_t cmds[] = {
{"db_ctx", (cmd_function)NULL, 0, 0, 0, 0},
{"db_con", (cmd_function)pg_con, 0, 0, 0, 0},
{"db_uri", (cmd_function)pg_uri, 0, 0, 0, 0},
{"db_cmd", (cmd_function)pg_cmd, 0, 0, 0, 0},
{"db_put", (cmd_function)pg_cmd_exec, 0, 0, 0, 0},
{"db_del", (cmd_function)pg_cmd_exec, 0, 0, 0, 0},
{"db_get", (cmd_function)pg_cmd_exec, 0, 0, 0, 0},
{"db_upd", (cmd_function)pg_cmd_exec, 0, 0, 0, 0},
{"db_sql", (cmd_function)pg_cmd_exec, 0, 0, 0, 0},
{"db_res", (cmd_function)pg_res, 0, 0, 0, 0},
{"db_fld", (cmd_function)pg_fld, 0, 0, 0, 0},
{"db_first", (cmd_function)pg_cmd_first, 0, 0, 0, 0},
{"db_next", (cmd_function)pg_cmd_next, 0, 0, 0, 0},
{"db_setopt", (cmd_function)pg_setopt, 0, 0, 0, 0},
{"db_getopt", (cmd_function)pg_getopt, 0, 0, 0, 0},
{"db_bind_api", (cmd_function)db_postgres_bind_api, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0}
};
Regards,
Nicolas.
This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are
not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message.