Skip to content

Instantly share code, notes, and snippets.

View tahoemph's full-sized avatar

Michael Hunter tahoemph

View GitHub Profile
@tahoemph
tahoemph / postres_system.sql
Created December 21, 2020 15:25
Collection of useful postgres queries both found and made
-- table + index sizes
SELECT
table_name,
pg_size_pretty(table_size) AS table_size,
pg_size_pretty(indexes_size) AS indexes_size,
pg_size_pretty(total_size) AS total_size
FROM (
SELECT
table_name,
pg_table_size(table_name) AS table_size,
const list_of_primes = [2, 3, 5];
function* prime_generator() {
for (prime of list_of_primes) {
yield prime;
}
for(let next_possible_prime = list_of_primes.slice(-1)[0] + 2;;next_possible_prime += 2) {
const max_check = Math.ceil(Math.sqrt(next_possible_prime));
for (known_prime of list_of_primes) {
if (known_prime > max_check) {