Forum OpenACS CMS: Re: OpenACS database API

4: Re: OpenACS database API (response to 1)
Posted by Gustaf Neumann on
Dear Bernard,

NaviServer supports two interface families (nsdb and nsdbi) to talk to the database backends. The first one (nsdb) is the classical one, which is also the one used for the OpenACS "db_*" interface [1], used in AOLServer and NaviServer. The nsdbi interface is newer, and comes with prepared statements, which is for many applications performance-wise better than nsdb. The xotcl-core package of OpenACS offers a uniform interface to both, nsdb and nsdbi [2], supporting also prepared statements for nsdb.

One disadvantage of nsdbi it has no means to deactivate prepared statements, such that under certain conditions (SQL-queries with constants, inserted via e.g. Tcl substitutions - actually a bad style) might cause a bloat of the prepared statements. When this happens, there is a significance performance hit. This can be a problem with huge legacy DB applications like with OpenACS, but it is normally not an issue. When you run into problems, just post, we are here to help you.

One can certainly use the nsdb interface of NaviServer also without OpenACS [3].

PS: a few years ago, a student made a comparison of Apache+PHP+PostgreSQL vs. NaviServer+nsdbi+PostgreSQL with the same queries (taken from real-world applications), which showed a significant advantage of the NaviServer performance.