Forum OpenACS Development: Response to PG Object Extensions - pros and cons

Collapse
Posted by Dan Wickstrom on
I think Jonathan points out a contraction in our porting strategy.  On the one hand you have argued that we should aim for sql92 compliance, but on the other hand you're advocating the use of postgresql-specific features such as inheritance to help with performance issues and to obtain a more readable data-model.    As far as readiblity, It will be somewhat simpler, but the net gain is pretty small.  With acs classic you can follow the inheritance path by looking at the acs_object.create_type calls.  In the proposed openacs method of using pg's inheritance constructs, you will have an explicit inherits declaration on a particular table.  So for instance the users table will look something like:

create table users ( ....) inhertits (persons);

That is somewhat clearer, but not a huge win over tracing down the acs_object.create_type calls.

The performance gains are not quantified, so it's not easy to assess the value.  From looking at the acs object model, it seem that there are not a huge amount of joins generated by the model that acs classic uses.  I think that is primarily due to fact that the the core code does not make use of deep inheritance structures.  An exception to that is the new community-core data model which has decompoesed the old 3.x users table into users -> persons -> parties -> acs_objects.  Queries for user information are then done through a couple of views that hide the complexity of joining.  So I think in the case of the users table, there might be some significant gains to be made by using inheritance.  The old user_groups table from acs 3.x has undergone a similar transformation where it has been decomposed to groups -> parties -> acs_objects.  But other than the users and groups tables, most "classes" only inherit from the acs_objects_type.  So in the most common case, you would only need do a simple join against acs_objects when referencing a particular object.  In addition, the application development notes recommend against doing joins and applying application-specific semantics to the acs_objects table when developing applications.