Examples

Page 32 of 50

Browse code examples

rustSnippet

Stdin Read Line With Parse Retry

Read stdin in a loop with read_line, clear and reuse one buffer, treat EOF as zero bytes, and match the parse Result so bad input retries instead of panicking.

sqlSnippet

COLLATE Explicit Sort Order

Control string comparison per column, per query, and per index with COLLATE, so the same names sort differently per language and indexes stay usable.

sqlSnippet

COPY FROM STDIN CSV Bulk Load

Load CSV in one atomic statement with COPY, choosing server-side file reads or the client-side \copy equivalent and skipping row-by-row inserts.

sqlSnippet

Cross Join Combination Matrix

Build a full combination matrix with CROSS JOIN, then LEFT JOIN real facts onto the skeleton so empty combinations show as zero instead of disappearing.

sqlSnippet

Drop Column Is Metadata Only

ALTER TABLE DROP COLUMN finishes instantly regardless of table size because only catalog metadata flips; old bytes stay in the heap until a rewrite.

sqlSnippet

For Update Nowait Fail Fast

FOR UPDATE NOWAIT fails immediately with lock_not_available when another transaction holds the row, choosing a loud failure over unbounded queue waiting.

sqlSnippet

Index Cond Versus Filter

Index Cond pushes equality and range predicates into the index scan; non-indexed columns surface as a post-scan Filter with rows-removed cost.