On Mon, Mar 30, 2015 at 7:41 PM, Jim Nasby <jim.na...@bluetreble.com> wrote: > > On 3/27/15 2:23 PM, Fabrízio de Royes Mello wrote: >> >> Hi all, >> >> I'm tweaking some autovacuum settings in a table with high write usage >> but with ALTER TABLE .. SET ( .. ) this task was impossible, so I did a >> catalog update (pg_class) to change reloptions. >> >> Maybe it's a stupid doubt, but why we need to get an AccessExclusiveLock >> on relation to set reloptions if we just touch in pg_class tuples >> (RowExclusiveLock) ? > > > For a very long time catalog access was not MVCC safe. I think that's been changed, so at this point it may be OK to relax the lock, at least in the case of autovac settings. There may well be other settings in there where it would not be safe. >
Hummm.... There are a comment in AlterTableGetLockLevel: 3017 /* 3018 * Rel options are more complex than first appears. Options 3019 * are set here for tables, views and indexes; for historical 3020 * reasons these can all be used with ALTER TABLE, so we can't 3021 * decide between them using the basic grammar. 3022 * 3023 * XXX Look in detail at each option to determine lock level, 3024 * e.g. cmd_lockmode = GetRelOptionsLockLevel((List *) 3025 * cmd->def); 3026 */ 3027 case AT_SetRelOptions: /* Uses MVCC in getIndexes() and 3028 * getTables() */ 3029 case AT_ResetRelOptions: /* Uses MVCC in getIndexes() and 3030 * getTables() */ 3031 cmd_lockmode = AccessExclusiveLock; 3032 break; Maybe it's time to implement "GetRelOptionsLockLevel" to relax the lock to autovac settings (AccessShareLock). To other settings we continue using AccessExclusiveLock. There are some objection to implement in that way? Regards, -- Fabrízio de Royes Mello Consultoria/Coaching PostgreSQL >> Timbira: http://www.timbira.com.br >> Blog: http://fabriziomello.github.io >> Linkedin: http://br.linkedin.com/in/fabriziomello >> Twitter: http://twitter.com/fabriziomello >> Github: http://github.com/fabriziomello