Skip to content

Instantly share code, notes, and snippets.

View tOlorun's full-sized avatar

Oluwaseun Omotosho tOlorun

View GitHub Profile
@tOlorun
tOlorun / function.sql
Created September 12, 2018 07:07 — forked from ichux/postgresql_version.sql
sharding id at instagram
-- change the public to schema of choice
CREATE OR REPLACE FUNCTION public.next_id(OUT result bigint) AS $$
DECLARE
our_epoch bigint := 1314220021721;
seq_id bigint;
now_millis bigint;
shard_id int := 5;
BEGIN
SELECT nextval('ips_id_seq'::regclass) % 1024 INTO seq_id;
@tOlorun
tOlorun / pubsub-coordinator.sql
Created April 3, 2019 01:02 — forked from marcocitus/pubsub-coordinator.sql
Prototype for PubSub on PG 10 with Citus 7
/* commands to run on the coordinator */
CREATE EXTENSION citus;
SELECT master_add_node('10.0.0.2', 5432);
SELECT master_add_node('10.0.0.3', 5432);
SELECT start_metadata_sync_to_node(nodename, nodeport) FROM pg_dist_node;
SET citus.replication_model TO 'streaming'
CREATE TABLE events (
event_id bigserial primary key,
@tOlorun
tOlorun / install_sqlplus.md
Created September 9, 2019 09:06 — forked from tcnksm/install_sqlplus.md
How to install oracle client to Ubuntu 12.04

Install SQL*Plus

  1. Download .rpm package here
    • oracle-instantclinet*-basic-*.rpm
    • oracle-instantclinet*-devel-*.rpm
    • oracle-instantclinet*-sqlplus-*.rpm
  2. Install alien (sudo apt-get install alien)
  3. Convert the rpm files and install
    • sudo alien -i oracle-instantclinet*-basic-*.rpm
  • sudo alien -i oracle-instantclinet*-devel-*.rpm
@tOlorun
tOlorun / asyncpgsa_benchmark.py
Created February 17, 2020 00:51 — forked from nhumrich/asyncpgsa_benchmark.py
asyncpgsa benchmark against aiopg.sa
import asyncio
import aiopg
import aiopg.sa
import asyncpg
import asyncpgsa
import sqlalchemy as sa
pg_tables = sa.Table(
'pg_tables', sa.MetaData(),
sa.Column('schemaname'),