Forum OpenACS Q&A: Response to File Storage Module Extremely Slow

Collapse
Posted by Don Baccus on
I've just committed this change to the CVS tree, thanks.

The history is that the original Oracle query, stripped to the bit relevant to this bug, did this:

select fsf2.parent_title from fs_files fsf1, fs_files fsf2
where fsf1.parent_id = fsf2.file_id(+)
The outer join is used to return NULL as the file parent's title if the file is at the root-level of the hierarchy.

Since pre-7.1 PG doesn't have outer joins, this query was split into two:

select fsf1.parent_id from fs_files fsf1, fs_files fsf2
where fsf1.file_id = $file_id
followed by:
set parent_title [database_to_tcl_string_or_null $db "
   select parent_title from fs_files where file_id = $parent_id"]
Whichever of us did it forgot to remove the second reference to fs_files when removing the outer join, resulting in a cross-join on fsf1, fsf2.

Oops!