Hotmail <crajac66@xxxxxxxxxxx> writes: > If it is possible to log long running internal queries as outlined above any guidance would be appreciated. Either auto_explain or pg_stat_statements could have helped you with that, I think. I believe (without having tested) that if configured to track nested statements they would perceive the FK enforcement query as a separate statement to track. regards, tom lane