SQLAlchemy + Postgres Cheatsheet 06 — Full-Text Search
Cheatsheet: generated tsvector, websearch_to_tsquery, ts_rank, headline snippets, trigram hybrid.
Cheatsheet: generated tsvector, websearch_to_tsquery, ts_rank, headline snippets, trigram hybrid.
LISTEN/NOTIFY patterns: real-time event delivery, queue wake-up, payload limits, and combining with the outbox pattern.
Cheatsheet: row locking, NOWAIT, SKIP LOCKED queue, advisory locks (session and tx scoped).
Postgres declarative partitioning via SQLAlchemy: range/list/hash partitions, pg_partman automation, indexes per partition.
Cheatsheet: NOTIFY from a transaction, listen via asyncpg, outbox + LISTEN wake-up pattern.
Postgres RLS for multi-tenant SQLAlchemy: defining policies, setting tenant context per request, and integration with FastAPI.
Cheatsheet: enable RLS, write policies, set tenant per request, application role without BYPASSRLS.
Postgres-specific bulk operations: ON CONFLICT, RETURNING, bulk insert via execute, asyncpg COPY for huge data.
Cheatsheet: ON CONFLICT DO UPDATE / DO NOTHING, RETURNING, bulk insert via execute(insert(), list), asyncpg COPY.
Streaming replication, read replica routing, failover handling in SQLAlchemy, and using pgvector for embeddings.