Re: Foreign key creation on table with huge record count.
От | Scott Ribe |
---|---|
Тема | Re: Foreign key creation on table with huge record count. |
Дата | |
Msg-id | 954C1F48-B9C7-48FE-A135-E643EBCD9892@elevated-dev.com обсуждение исходный текст |
Ответ на | Foreign key creation on table with huge record count. (Gambhir Singh <gambhir.singh05@gmail.com>) |
Список | pgsql-admin |
> On Jan 30, 2023, at 1:12 PM, Gambhir Singh <gambhir.singh05@gmail.com> wrote: > > do we have parallel hint like option in postgreSQL as there in Oracle. I don't know of a hint option you can put on a query. But if you are running a recent enough version of PG, there are optionsto support parallel queries, and you can tune up number of workers etc. I don't actually know if it can use multipleworkers on constraint creation, but you can use "explain" on your command to create the constraint, to see if theplanner will be using parallel workers. Of course make sure that the field being referred to is indexed, in other words given col1 references table2(col2) make sure col2 is indexed Is this operation effectively taking your database out of service while it runs? If so, then you can temporarily use a configtuned for just this: let work mem for this one connection use up a big % of RAM, use multiple workers etc. In somecases I've even turned fsync off--this means if you crash you could wind up with a corrupted database, but if you havea current backup, then you either succeed and turn fsync back on when you're done, or you have your backup if somethingbad happens.
В списке pgsql-admin по дате отправления: