Re: Impact of foreign keys on a simple count(*) ?
| От | Tom Lane |
|---|---|
| Тема | Re: Impact of foreign keys on a simple count(*) ? |
| Дата | |
| Msg-id | 23596.1097293763@sss.pgh.pa.us обсуждение |
| Ответ на | Impact of foreign keys on a simple count(*) ? ("C. Bensend" <benny@bennyvision.com>) |
| Ответы |
Re: Impact of foreign keys on a simple count(*) ?
|
| Список | pgsql-sql |
"C. Bensend" <benny@bennyvision.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
В списке pgsql-sql по дате отправления: