Hendrik Visage <hvjunk@gmail.com> writes:
On Fri, Apr 1, 2011 at 3:05 PM, Gergely Nagy <algernon@balabit.hu> wrote:
Prepared statements -------------------
We'll use prepared statements wherever possible - I expect this alone will result in a measurable performance increase, since the server will not have to parse each and every insert - only once, we'll bind variables thereafter.
This is also a performance increase for Postgresql/etc. so this should (IMHO) be an universal method for all the SQL drivers, as it is expected give a global rather than specific gain.
Indeed, prepared statements will be implemented for all native drivers that support it, postgres included. I can't make it a global feature, since libdbi does not support it as far as I know, so I have to bring it out to the native-driver level (and since those use the respective C libraries instead of a libdbi bridge, they all implement prepared statements a bit differently).
Postgresql's COPY appears to be equivalent to the MySQL's LOAD, so my advice will be to keep these two methods in a way to easily replace/substitute for Postgresql ;)
Well, COPY is a lot friendlier than LOAD, from my side for sure, but it's syntax is different enough that there's not much code that could be shared. On the other hand, the last step of The Plan, which I forgot to list, is that once we have drivers for the most used sql database types (mysql, postgres & sqlite; I'll leave oracle to someone who dares to touch it), I'll see if there's enough common code that could be shared between these. Basically, we'll have a single sql() statement, but the afsql driver itself will be nothing more than a configuration interface for - say - afsql-dbi, afsql-mysql, afsql-mysql-handlesocket, afsql-postgres, afsql-sqlite, and so on. These all will use the same configuration, give or take a few options here and there, but the underlying module will be almost entirely separate in the beginning. -- |8]