Finding a Partitioning Algorithm
Group-By is a beautiful Clojure function which takes a collection and groups it into a map of results based on a grouping function:
Postgres: Email Parsing using perl
This function extracts the real name from an email address. With slight variations, other components such as local part or host name can be extracted. Relying on a well-tested Perl module makes this function extremely robust, compared to say handcrafted pattern-matching approaches.
CREATE OR REPLACE FUNCTION email_name(email text) RETURNS text LANGUAGE plperlu AS $$ use Email::Address; my @addresses = Email::Address->parse($_[0]); return undef unless scalar(@addresses) > 0; return $addresses[0]->name; $$;
URI data type for PostgreSQL
This is an extension for PostgreSQL that provides a
uri
data type. Advantages over using plaintext
for storing URIs include:
- URI syntax checking
- functions for extracting URI components
- human-friendly sorting
The actual URI parsing is provided by the uriparser library, which supports URI syntax as per RFC 3986.
Startups using Postgres:
- Instagram (Handling Growth with Postgres: 5 Tips From Instagram)
- Nextdoor (What is the technology behind Nextdoor?) — I work here.
- Uber (Page on dropboxusercontent.com) — Migrating from MySQL to Postgres.
- Disqus (Postgres at Disqus – keynote)
- Reddit (High Scalability – High Scalability – Reddit: Lessons Learned from Mistakes Made Scaling to 1 Billion Pageviews a Month)
- Etsy (PostgreSQL Featured Users)
- Skype (PostgreSQL Featured Users)