Lock:relation

This event occurs when a process is waiting to acquire a heavyweight lock on a database object—most commonly a table, but it could also be an index, view, or sequence.
Unlike the "Lightweight" locks (like BufferContent or BufferIO) which protect memory or I/O and last for microseconds, Relation locks are "Heavyweight" locks that protect the logical structure and data integrity of your tables.
They can last for the entire duration of a transaction.

What does it mean?

In PostgreSQL, every query requires a certain "Lock Mode" on a table to ensure that someone else doesn't change the rules while the query is running.

Common scenarios when this occurs: