Search Postgresql Archives

Re: How are foreign key constraints built?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux