Skip to content

Commit c8c6182

Browse files
committed
Improve perfomance issue for DELETE command
1 parent 5ad0d58 commit c8c6182

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/closure_tree/hierarchy_maintenance.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,9 @@ def delete_hierarchy_references
9898
FROM (SELECT descendant_id
9999
FROM #{_ct.quoted_hierarchy_table_name}
100100
WHERE ancestor_id = #{_ct.quote(id)}
101-
) AS x )
102-
OR descendant_id = #{_ct.quote(id)}
101+
) AS x );
102+
DELETE FROM #{_ct.quoted_hierarchy_table_name}
103+
WHERE descendant_id = #{_ct.quote(id)}
103104
SQL
104105
end
105106
end

0 commit comments

Comments
 (0)