Wes <wespvp@xxxxxxxxxxxx> writes: > There's no problem here, I'd just like to understand what it is doing. Either a hash or merge join between the two tables, to verify that all the keys in the referencing table exist in the referenced table. The intermediate data is evidently spilling to disk. > I expected adding the foreign key constraint would just use the existing > indexes to verify the database is currently consistent. People have this weird notion that an index-based plan is always faster than anything else. If you like you can try the operation with "set enable_seqscan = off", but I bet it will take longer. regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 6: Have you searched our list archives? http://archives.postgresql.org