~/talk

Everything you need to know about Postgres Row Level Security

Talkat POSETTE: An Event for Postgres 2024 · 2024-06-11..06-13· [databases]
slides:none on file

Concrete how-to plus performance rules for Postgres Row Level Security: enable RLS on tables by running ALTER TABLE ... ENABLE ROW LEVEL SECURITY and create one policy per operation (SELECT/INSERT/UPDATE/DELETE) rather than ALL, because multiple policies OR by default and become AND only for restrictive policies. Wrap auth function calls with select auth.uid() so the planner calls them once, mark auth functions STABLE and create them with SECURITY DEFINER in a private schema, always include a WHERE filter for performance, and use RLS-aware views (PG15+); Supabase benchmarks show measurable speedups and practices at scale (they host over a million Postgres DBs).

AI-written summary · about

  1. 0:00Intro
  2. 2:11What is row level security
  3. 4:25Why row level security
  4. 6:39How to implement row level security
  5. 9:41USING clause
  6. 11:03WITH CHECK clause
  7. 11:42One table can have multiple policies
  8. 12:56Do's & Don'ts for row level security
  9. 17:23Tip & tricks
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.