Skip to Content.
Sympa Menu

devel - Re: [sympa-developpers] RDBMS

Subject: Developers of Sympa

List archive

Chronological Thread  
  • From: David Verdin <address@concealed>
  • To: address@concealed
  • Subject: Re: [sympa-developpers] RDBMS
  • Date: Thu, 10 Jan 2013 09:33:15 +0100


Le 09/01/13 18:24, Guillaume Rousse a écrit :
'greatly' vastly depends on your usage. Only repeated queries (such as: who is member of list X) would offer actual performance improvement. And we'd need benchmark anyway to measure them.
Indeed.
Actually, if you do a query only two times, you're supposed to gain the compilation time for the second execution. But there is also a cost to maintain the query handles in memory.

I don't think we first need to switch to an ORM to achieve this, tough, and the current framework would easily be converted to achieve this. That's just a matter of using placeholders instead of sprintf format in SQL queries, and caching the result of prepare() with the raw query.

For instance:

Sympa::SDM::do_query->('SELECT count(*) FROM user_table WHERE email_user = ?', $who);

sub do_query {
my ($query, @params) = @_;

my $sth = $cache->{$query} ||= $dbh->prepare($query);
return $sth->execute(@params);
}
Actually, I'm progressively converting queries to precompiled queries; Once it is done, I think we can adpat the framework.

The additional side-effect is to let DBI handle quoting directly...
Which would be good, too: no need to bother quoting when creating a query.

Cheers,

David




Archive powered by MHonArc 2.6.19+.

Top of Page