Alex,
On 12/21/2009 03:00 PM, alex pappas wrote:
What do you suggest for faster sql queries with mysqlp : avpops or sqlops ?
I don't think it's really a question of speed as of flexibility, ease of programming, and conceptual propriety.
The avpops module is a slightly antiquated facility, and its present-day use does not very closely reflect its original purpose as a database-backed "key-value" store of some sort. I get the impression that avp_db_query() was added to it as sort of a minor afterthought; I think that the assumption that persisted in the peak of avpops' reign was that the utility of *SER for most people was bound up in its modules (with their related database schemas).
What happened afterward was that there was an explosion of usage that revolved around custom database integration and it became a more accepted fact of Kamailio's existence, and that is why the sqlops module was written to make it easier. The sqlops module operates in a manner that much more closely resembles the database APIs of other programmatic environments, e.g. the ability to determine number of rows returned, the ability to iterate through results without having to utilise crude and implicit AVP arrays, etc.
I imagine that avp_db_query() and sql_query() are implemented very similarly underneath, and in any case, both utilise the same database interface layers (db_postgres, db_mysql, etc.), which is where the data interchange implementation that has the most relevance to speed actually resides.
In short, I don't think sqlops is materially faster, but it is a more modern and sophisticated way to talk to your database and you should use it for that reason.