"C. Bensend" <benny(at)bennyvision(dot)com> writes:
> Is it the addition of the multiple foreign keys that is slowing this
> down so much?
Foreign keys have zero, nada, zilch to do with the performance of
count(*). The only plausible theory I can think of for the performance
difference is that in your "new" database the table has been through
several mass updates, leading to a whole lot of dead rows and a much
larger physical table size to scan through. I'd suggest a VACUUM
VERBOSE on both old and new copies of the table to get an idea of the
relative physical sizes. You might need a VACUUM FULL to get the new
table back down to a reasonable size...
regards, tom lane