Forum OpenACS Development: Re: Very slow query

Collapse
8: Re: Very slow query (response to 3)
Posted by Andrei Popov on

Dirk,

You may be right, but it looked to be the same at first glance. Given that acs_object_context_index is actually

create table acs_object_context_index (
	object_id	integer not null
                        constraint acs_obj_context_idx_obj_id_fk
			references acs_objects(object_id),
	ancestor_id	integer not null
                        constraint acs_obj_context_idx_anc_id_fk
			references acs_objects(object_id),
	n_generations	integer not null
			constraint acs_obj_context_idx_n_gen_ck
			check (n_generations >= 0),
        constraint acs_object_context_index_pk
	primary key (object_id, ancestor_id)
);
and acs_object_contexts is
create view acs_object_contexts
as select object_id, ancestor_id, n_generations
   from acs_object_context_index
   where object_id != ancestor_id;
i.e. it is a view at acs_object_context_index where object_id and ancestor_id are not the same, doing a delete on acs_object_context_index for specified object_id/ancestor_id excluding the case when they are the same should do the trick, shouldn't it?