Subject: Developers of Sympa
List archive
- 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.
Actually, I'm progressively converting queries to precompiled queries; Once it is done, I think we can adpat the framework.
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);
}
Which would be good, too: no need to bother quoting when creating a query.
The additional side-effect is to let DBI handle quoting directly...
Cheers,
David
-
Re: [sympa-developpers] RDBMS,
IKEDA Soji, 01/08/2013
-
Re: [sympa-developpers] RDBMS,
David Verdin, 01/09/2013
-
Re: [sympa-developpers] RDBMS,
Guillaume Rousse, 01/09/2013
- Re: [sympa-developpers] RDBMS, David Verdin, 01/10/2013
-
Re: [sympa-developpers] RDBMS,
Guillaume Rousse, 01/09/2013
-
Re: [sympa-developpers] RDBMS,
David Verdin, 01/09/2013
Archive powered by MHonArc 2.6.19+.