Worm with Glasses

Coding • DevOps • Personal

Oct 18, 2017

🔗 Efficient pagination of a table with 100M records

This Chapter is focused on efficient scanning a large table using pagination with offset on the primary key. This is also known as keyset pagination.

Efficient pagination of a table with 100M records

The key insight is to use the primary key as the offset to avoid missing records (if they’re deleted between invocations) and to increase performance by using a RANGE join type, which is much faster (constant time.)

Simplified algorithm:

  1. We get PAGE_SIZE number of records from the table. Starting offset value is 0.
  2. Use the max returned value for the primary key (i.e., user_id) in the batch as the offset for the next page.
  3. Get the next batch from the records which have the primary key (i.e., user_id) value higher than current offset.

For example:

SELECT user_id, external_id, name, metadata, date_created
FROM users
WHERE user_id > 51 234 123 --- value of user_id for 50 000 000th record
ORDER BY user_id ASC
LIMIT 10 000;

Sep 3, 2017

🔗 Yes, That Web Project Should Be a PWA

a PWA is a website with special powers. The term “app” in the “Progressive Web App” is not indicative of the sort of content or experience users should expect with a PWA. You shouldn’t get hung up on it; “Progressive Web App” is a marketing term. PWAs have the ability to connect with the operating system (and, thereby, its users) on a deeper level through installation and APIs offering capabilities like notifications, access to the address book, and more. Not all of these APIs require installation for access, but some do. It may help to think about a PWA as being a website++.

Yes, That Web Project Should Be a PWA

Sep 3, 2017

🔗 How to launch a company when investors ain’t writing checks

All we talk about in tech is unicorns, when we should be talking about zebras. Unlike unicorns, zebras are REAL. Zebra companies are black and white — they are profitable and socially conscious. They band together in groups to protect one another. They seek to share resources instead of hoarding them. And they are more concerned about user success than user acquisition.

How to launch a company when investors ain’t writing checks

Sep 1, 2017

Sep 1, 2017