Hi You're writing really on time :-). Currently SMSD is under heavy development and you can still influence how it will look in next release.
Dne Fri, 6 Feb 2009 16:15:23 +0100 Gerfried Fuchs <rho...@debian.at> napsal(a): > While debugging why gammu takes ages with mysql backend to send a > simple sms I stumbled upon something that made me feel highly > uncomfortable about it. The (my)sql support lacks of all sql basics, > like using indexes in the tables, usage of autoincrement fields for IDs > or at least the max() function instead of ORDER BY ID DESC LIMIT 1. The problem with using autoincrement (at least in the case you are talking about) is that we need to find ID which does not exists in two tables. > Pretty please do NOT loop with "while (true)" over a "SELECT ID FROM > sentitems WHERE ID='%i'" when it actually only really wants to know the > largest unused ID ... > > I just checked, it's the same horror function in s_pgsql.c ... Yes, AFAIK it was created by copying s_mysql.c and replacing some functions. > These > are SQL basics and performance killers, when one has sent about 2000 > SMSes (which isn't that much, is it?) it starts to lag behing quite a > lot through the repeated loop, starting to take minutes instead of not > even a few seconds for sending a simple text message ... I know the code is really bad. Thats why I started with new backend using DBI to support more SQL databases. It still has some bad parts (it is based on same database structure to be compatible with old ones and parts of code come from old ones), but I think it's much better than current one. Can you please look at the new code and share your thoughts what should be improved first? http://viewsvn.cihar.com/viewvc.cgi/gammu/trunk/smsd/services/dbi.c?view=markup PS: I know that using static buffers is bad and I'm going to change this and way how SQL is generated soon. -- Michal Čihař | http://cihar.com | http://blog.cihar.com
signature.asc
Description: PGP signature