Examples

Page 23 of 50

Browse code examples

rustSnippet

Thread Park And Unpark Handoff

Hand a signal between threads with thread::park and Thread::unpark, which needs no channel and keeps an unpark that arrives before the park.

rustSnippet

Vec Splice Replace Range

Replace a middle range in place with Vec::splice, keep the removed elements, and reuse the same call with an empty iterator to delete.

sqlSnippet

Do Block Loops With Notice

Run anonymous procedural code inline with a DO block, using an integer FOR loop and RAISE NOTICE to emit progress lines from a psql session.

sqlSnippet

Layered CTE Pipeline

Compose a multi-stage query as named CTE layers — filter, deduplicate, then aggregate — so each stage reads independently and later stages stay simple.

sqlSnippet

Pg Prewarm Loads Relation Cache

Load a table or index into shared_buffers with pg_prewarm before benchmarking, so the first measured run does not pay the cold-cache disk read cost.