Incremental Sort Plan Fallback
Use a leading-column index then sort the remainder: the plan shows an Incremental Sort node instead of a full Sort when the prefix is presorted.
Page 26 of 50
Use a leading-column index then sort the remainder: the plan shows an Incremental Sort node instead of a full Sort when the prefix is presorted.
Turn one JSON object per row into key/value pairs with jsonb_each_text, then filter or aggregate pairs that columns cannot express.
Update nested JSON paths with jsonb_set: provide the path array, the new value, and control whether missing keys get created.
justify_interval folds raw interval components into days, hours, and minutes so a computed duration prints as a stable single unit set.
Cap how long ALTER TABLE waits for its access-exclusive lock, so a queued migration fails fast instead of stalling every query behind it.
Build date and interval values from integers with make_date, make_timestamptz, and make_interval instead of fragile string parsing.
Feed a Merge Join with pre-sorted inputs: when both sides have matching index order the planner merges streams in one pass without a hash table.
Store non-contiguous slots in one multirange value: overlaps merge on construction, containment and intersection work across all segments.
The SQL-standard OVERLAPS predicate compares two (start, end) interval pairs with half-open semantics, no range types required.
Enforce one active row per key with a partial unique index: uniqueness applies only inside the WHERE predicate, history rows stay unlimited.
CREATE INDEX on a partitioned parent builds and attaches a child index per partition, or defers with ON ONLY until every partition attaches.
enable_partitionwise_join lets the planner pair up partitions and join per partition when both tables are partitioned on the join key.
Ordered-set aggregates interpolate or select: percentile_cont can return values that never occurred, percentile_disc always returns a real row value.
Compare octet_length and pg_column_size on a ~6KB incompressible column: the value goes out of line uncompressed and the heap row keeps only a pointer.
Rank real workload queries by total time with pg_stat_statements: enable the extension once, then read normalized call counts and timing.
After five EXECUTEs the planner may switch a prepared statement from custom to generic plans; pg_prepared_statements exposes the counters.
Value-offset RANGE frames measure distance on the sort key itself, so rows within 5 units of the current value share one frame.
Cap runaway recursion with a depth counter in the recursive term: rows past the cap stop propagating, bounding the walk on bad data.
Split a table footprint with pg_table_size, pg_indexes_size, pg_total_relation_size, and per-fork pg_relation_size to see where bytes really go.
A window ORDER BY with tied keys uses the default RANGE frame, so peer rows enter the frame together and the running total jumps instead of ticking.
Split compound identifiers like partition-host-index with split_part, and reach fields behind the first or last separator with negative indexes.
CREATE TABLE LIKE with INCLUDING ALL copies defaults, constraints, and indexes, giving staging tables the parent guarantees.
Resolve a table name to an OID with to_regclass: unknown names return NULL instead of raising, enabling guard clauses in scripts.
Point two FOREIGN KEY columns at the same parent table and give each a role name plus its own ON DELETE behavior, so sender and receiver stay distinct.
Run one UNION ALL query where each source subquery keeps its own ORDER BY and LIMIT, so per-table top rows are computed before fanning out.
Aggregate rows in a grouped subquery and join it in UPDATE ... FROM, so per-customer totals land in one deterministic statement.
The intrinsic Capitalize type transforms literal unions inside the type system, so mapped keys like onHomeClick are derived and checked, never hand-written.
The & operator stacks independent interfaces into one stricter type, and a conflicting field between members collapses to never at compile time.
A Partial Record over literal endpoint keys tracks hit counts, so misspelled endpoints fail to compile and absent keys stay undefined instead of zero.
Abort the previous request the moment a newer one starts and drop superseded results, so a slow response can never overwrite the newest answer.
Freeze lookup tables with as const so keyof typeof yields exact key unions, arrays expose element unions, and Record mismatches fail at compile time.
elementFromPoint answers which element owns a viewport coordinate, and an overlay intercepts hits until it opts out with pointer-events none.
Declare capability surfaces with interfaces and make classes opt in via implements, so missing members or wrong signatures fail at compile time.
Pull field types along object paths with indexed access types, so renamed config fields keep their derived types in sync without hand-written duplicates.
Model PATCH payloads with Partial<T> so clients may set any subset of keys, merge with spread, and remember nesting still replaces whole objects.
Define arbitrary-depth JSON payloads with a recursive type alias and walk them with narrowing, counting leaves and tracking nesting depth in one pass.
Attach per-field messages with setCustomValidity, clear them with an empty string to restore built-in checks, and arbitrate submission with checkValidity.
Rows of a two-dimensional slice can share one backing array: append on one row overwrites the next row, so allocate each row independently.
Encrypt and decrypt with AES-GCM from the standard library: a random nonce travels with the ciphertext and one flipped bit fails authentication on open.
Extraction validates every entry name before touching disk: absolute paths and .. components are rejected so archives cannot write outside the target.
Assign or pass [N]T arrays and each call copies the whole value, while a slice view of the same array keeps sharing the underlying storage.
Store and swap typed snapshots with atomic.Pointer: loads need no type assertion, and CompareAndSwap matches pointer identity rather than field values.
Guard a single counter with atomic.Int64 and protect cross-field invariants like budgets with a mutex, choosing the primitive that matches the workload.
math/big computes factorials and powers that overflow int64, with Exp for exponents and IsInt64 to detect values that no longer fit in machine words.
Represent rates as big.Rat rational numbers so one-third stays exact in division, comparison, and re-float, instead of drifting through float64.
encoding/binary packs fixed-width integers in big-endian order for wire headers and shrinks small values into one-to-two-byte varints with AppendUvarint.
Encode fixed-width structs with binary.Write and binary.Read so the on-disk layout is explicit, byte counts are predictable, and endianness stays controlled.
A Scanner stops with token too long once a line exceeds 64KB; Buffer raises the cap so oversized log lines stream through without crashing.
bufio.Writer stages small writes in a buffer until Flush hands them on, and Buffered reports exactly how many bytes are still pending.
Grow a bytes.Buffer once, append strings bytes and runes through the io.Writer interface, then Reset it to reuse the backing array across batches.
Use a buffered chan struct{} as a counting semaphore: capacity caps concurrent workers, sends acquire, receives release, peak stays inside.
Decide per request whether the client follows a redirect by installing CheckRedirect, counting the chain length and stopping with http.ErrUseLastResponse.
cmp.Or returns the first non-zero argument, so environment fallback chains collapse into one line instead of nested if blocks per config key.
Register cleanup with context.AfterFunc so a canceled context triggers it in its own goroutine, and stop cancels the registration before the context ends.
WithTimeoutCause attaches a business reason to the deadline: ctx.Err stays DeadlineExceeded while context.Cause returns the specific cause for the failure.
Derive a reporting context with WithoutCancel so parent cancellation never reaches it, while context.Cause still explains why the parent stopped.
hash/crc32 computes an IEEE checksum over a payload, flags a tampered byte through a mismatching digest, and folds incremental chunks with Update.
Reader options adapt csv parsing to real files: Comma switches the delimiter, and LazyQuotes tolerates stray quotes instead of failing the row.
csv.NewWriter buffers rows behind an io.Writer, quoting commas and embedded quotes automatically, with Flush committing and Error reporting deferred failures.
Duplicate nested config before mutation with a recursive deep copy over map[string]any and []any, so edited snapshots never touch the original values.
See why defer inside a loop holds every resource until the function returns, and how extracting the iteration body closes each file on schedule.
A named result lets a deferred function rewrite the error after return: the Close failure is never lost and only wins when the body had none.
Trust magic bytes over file extensions: http.DetectContentType inspects the first 512 bytes and returns the canonical MIME type for upload validation.
Give producer and consumer functions send-only or receive-only channel parameters so misuse of a pipeline stage fails at compile time, not in production.
Signal completion with chan struct{} channels that carry zero bytes, broadcast to every waiter with close, and use map[string]struct{} as a free set.
Round-trip a typed catalog through encoding/xml: struct tags turn fields into attributes and child elements, and Unmarshal reads them back into the same values.
Errors can implement Is(error) bool so errors.Is matches by domain rules like status codes instead of requiring identical messages or pointers.
Wrap the stdlib ErrUnsupported sentinel in your own error so callers detect missing capabilities with errors.Is, not ad-hoc per-backend message strings.
Normalize user-supplied paths with filepath.Clean and Join, compute Rel between trees (a ../../-prefixed path, not an error), and split Base and Dir.
Match file names against shell-style patterns with filepath.Glob and fs.Glob, getting sorted results and an empty slice rather than an error on no match.
Walk a directory tree with filepath.WalkDir, tally files by extension, and return fs.SkipDir on dot-prefixed directories to prune hidden subtrees.
Implement flag.Value with Set validating each occurrence and String rendering the result, so a single -tag can repeat and accumulate into one slice.
Bind flags and positional arguments to an isolated flag.FlagSet: Parse splits flags from trailing operands and Args, NArg, and Arg expose the rest.
Sqrt of negatives yields NaN that fails every comparison, overflow yields Inf; IsNaN and IsInf guards keep NaN out of aggregated sums before it spreads.
Grow a reusable byte buffer with fmt.Appendf instead of fmt.Sprintf, so each formatted segment joins one backing array instead of allocating a new string.
Split read failures into expected and unexpected branches: fall back to defaults on fs.ErrNotExist and let other wrapped errors bubble up for the caller.
Feed code an in-memory fstest.MapFS so file-reading logic is tested against fixed content, with no temp directories or disk fixtures to clean up.
Variadic Option closures applied over defaults make client constructors extensible: callers override only the knobs they care about.
Write Map and Filter once with generics, reuse them for any element type, and chain filter before map while types infer at the call site.
encoding/gob serializes structs with maps and slices into a byte stream and restores them into fresh values with deep-copied composite fields.
A panic in a goroutine kills the whole process unless that same goroutine recovers; workers report failures through a channel instead of crashing main.
gzip.Writer wraps a byte buffer and Close flushes the final block; gzip.Reader hands the stream back through io.Copy so the round trip restores bytes exactly.
Race two replica calls through select and keep the first response, then cancel the derived context so the losing goroutine exits instead of leaking.
Encode bytes to lowercase hex with hex.EncodeToString, decode back losslessly, and see odd-length or invalid input fail with explicit errors.
http.Header canonicalizes keys on Set and matches them case-insensitively on Get, while Add stacks multiple values under one header name.
Attach httptrace hooks to a request against an httptest loopback server so connection reuse and first-byte arrival are observable without any external network.
Back an insertion-ordered map with a slice of entries plus an index map so set, get and delete stay O(1) while listing order matches insertion.
Chain readers sequentially with io.MultiReader and cap total consumption with io.LimitReader so combined streams stop cleanly at a byte budget.
io.Pipe hands bytes between goroutines synchronously: each Write blocks until the reader takes it, and the writer must Close to end the stream.
Frame parsing needs exact lengths: io.ReadFull reads until the buffer is full and reports ErrUnexpectedEOF on short payloads instead of silent truncation.
Read arbitrary records from a fixed-width stream with io.Seeker: absolute, relative, and end-relative seeks land exactly on record boundaries.
io.TeeReader mirrors every byte read into a hash.Hash, so one io.Copy pass forwards the payload and produces its digest without buffering it twice.
A const block with 1 << iota produces non-overlapping bit flags, and a has method checks permission masks with bitwise AND instead of booleans.
iter.Pull converts a push-style Seq into next and stop functions, so two generators can be advanced in lockstep inside one plain loop.
Decode one-off payloads with inline anonymous structs and json tags, including nested check lists, without declaring named types for every shape.
Show that json.Marshal encodes []byte fields as base64 strings and Unmarshal decodes them back to the original bytes without manual encoding steps.
Hash JSON payloads deterministically by decoding into any and re-marshaling, so two payloads that differ only in map key order produce the same digest.
encoding/json matches keys exactly first and case-insensitively as a fallback, so apikey still fills APIKey; unmatched keys are dropped silently.
The ,string struct tag option encodes numeric fields as quoted JSON strings and decodes them back, enforcing quoted-number wire contracts on both sides.
errors.As distinguishes malformed JSON from type mismatches: json.SyntaxError reports the failing byte offset and UnmarshalTypeError names the target field.