From c1f08838200d5fc00ac987752eb9b2058e3edc0c Mon Sep 17 00:00:00 2001 From: Sami Imseih Date: Fri, 12 Jan 2024 21:14:06 +0000 Subject: [PATCH 1/2] Add author attribution to ndistinct README --- examples/ndistinct/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/examples/ndistinct/README.md b/examples/ndistinct/README.md index a8e52c0..212ab79 100644 --- a/examples/ndistinct/README.md +++ b/examples/ndistinct/README.md @@ -1,3 +1,5 @@ +Inspired by a sql script authored by Jim Finnerty and proposed to the PostgreSQL hackers mailing list, https://www.postgresql.org/message-id/1548191628417-0.post%40n3.nabble.com + ## Calculating N-distinct elements During ```ANALYZE```, the ```n_distinct``` value of a column is calculated as either a fixed value or a ratio of the number of distinct values over the total number of rows. The fixed value is always represented as a positive number, while the ratio will be represented as a negative number. This value is visible in the n_distinct column of the ```pg_stats``` catalog view and used by the PostgreSQL query optimizer for planning. For more, refer to the PostgreSQL [[documentation]](https://www.postgresql.org/docs/current/view-pg-stats.html]). From 0c7c90b055dd588c25dc31939a300abeb2d5b1bc Mon Sep 17 00:00:00 2001 From: Adam Guo Date: Fri, 12 Jan 2024 23:33:05 +0000 Subject: [PATCH 2/2] Add uuid_v7 author attribution --- examples/uuid_v7/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/examples/uuid_v7/README.md b/examples/uuid_v7/README.md index 7ee932b..98aa7fc 100644 --- a/examples/uuid_v7/README.md +++ b/examples/uuid_v7/README.md @@ -1,3 +1,5 @@ +Inspired by a patch authored by Andrey Borodin and proposed to the PostgreSQL hackers mailing list, https://www.postgresql.org/message-id/CAAhFRxitJv%3DyoGnXUgeLB_O%2BM7J2BJAmb5jqAT9gZ3bij3uLDA%40mail.gmail.com. + ## Generating a UUID v7 [Universally unique identifiers](https://en.wikipedia.org/wiki/Universally_unique_identifier) (UUIDs) are a data type frequently used as primary keys due to their uniqueness property. Historically, one of the most popular methods of generating UUIDs was UUID v4, which randomly generated the UUID. However, this often caused poor index locality, as compared to a monotonically increasing integer, and can impact how quickly users can retrieve rows from a database. To improve this experience, [UUID v7](https://datatracker.ietf.org/doc/html/draft-peabody-dispatch-new-uuid-format-04#name-uuid-version-7) was proposed, which stores a portion of a UNIX timestamp in the first 48-bits before allowing for the generation of random data.