Skip site navigation (1) Skip section navigation (2)

Re: Optimizing FK & PK performance...

From: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>
To: "Sean P(dot) Thomas" <spt(at)ulanji(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Optimizing FK & PK performance...
Date: 2003-12-17 01:17:28
Message-ID: 3FDFAEA8.1090607@familyhealth.com.au (view raw or flat)
Thread:
Lists: pgsql-performance
> 1. Is there any performance difference for declaring a primary or 
> foreign key a column or table contraint?  From the documentation, which 
> way is faster and/or scales better:
> 
> 
> CREATE TABLE distributors (
>      did     integer,
>      name    varchar(40),
>      PRIMARY KEY(did)
> );
> 
> CREATE TABLE distributors (
>      did     integer PRIMARY KEY,
>      name    varchar(40)
> );

No difference - they're parsed to exactly the same thing (the first 
version).

> 2. Is DEFERRABLE and INITIALLY IMMEDIATE or INITIALLY DEFERRABLE 
> perferred for performance?  We generally have very small transactions 
> (web app) but we utilize a model of:

No idea on this one :/

Chris


In response to

pgsql-performance by date

Next:From: David ShadovitzDate: 2003-12-17 04:37:02
Subject: Re: Why is VACUUM ANALYZE <table> so slow?
Previous:From: Stephan SzaboDate: 2003-12-17 01:17:26
Subject: Re: Nested loop performance

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group