Forum OpenACS CMS: Re: OpenACS database API

Collapse
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].

-gn
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.

[1] https://openacs.org/api-doc/procs-file-view?path=packages/acs-tcl/tcl/01-database-procs.tcl
[2] https://openacs.org/xotcl/show-object?object=::xo::db::DBI&show_methods=2&show_source=1
[3] https://naviserver.sourceforge.io/n/nsdb/files/ns_db.html