Skip to content

Instantly share code, notes, and snippets.

View kmuthukk's full-sized avatar

Kannan Muthukkaruppan kmuthukk

View GitHub Profile
# Dependencies:
# On CentOS you can install psycopg2 thus:
#
# sudo yum install postgresql-libs
# sudo yum install python-psycopg2
import psycopg2;
from psycopg2 import OperationalError, errorcodes, errors
import datetime;
import random;
import os
import json
import time
from cassandra.cluster import Cluster, ExecutionProfile
cluster = Cluster(['127.0.0.1'])
profile = ExecutionProfile()
profile.request_timeout = 60
session = cluster.connect()
@kmuthukk
kmuthukk / ysql_concurrent_update.py
Created December 27, 2022 21:26
Concurrent updates to single row table
File Edit Options Buffers Tools Python Help
# Dependencies:
# On CentOS you can install psycopg2 thus:
#
# sudo yum install postgresql-libs
# sudo yum install python-psycopg2
import psycopg2;
from multiprocessing.dummy import Pool as ThreadPool
@kmuthukk
kmuthukk / ysql_many_colocated_tables.py
Created September 19, 2022 02:04
Script to creates lots of tables in a colocated database
# Dependencies:
# On CentOS you can install psycopg2 thus:
#
# sudo yum install postgresql-libs
# sudo yum install python-psycopg2
import psycopg2
from multiprocessing.dummy import Pool as ThreadPool
import time
# Dependencies:
# On CentOS you can install psycopg2 thus:
#
# sudo yum install postgresql-libs
# sudo yum install python-psycopg2
import psycopg2
from threading import Thread,Semaphore
import random
import time
@kmuthukk
kmuthukk / ycql_deletes_and_scan.py
Created August 31, 2022 23:38
Test for SCAN with LIMIT clause in presence of deleted, but perhaps not yet compacted, rows
# pip install yb-cassandra-driver
from cassandra.cluster import Cluster
from cassandra import ConsistencyLevel
import time
import random
from multiprocessing.dummy import Pool as ThreadPool
# Load Phase params
num_offsets=10000
@kmuthukk
kmuthukk / packed.sh
Last active August 15, 2022 21:34
Driver script for wide_rows.sql program to start a RF=1 cluster with desired settings, load data, flush/compact files and extract SST file sizes.
my_script() {
echo "================================="
echo "Running with ysql_enable_packed_row=$1 and compression_type=$2"
./bin/yb-ctl stop
./bin/yb-ctl start --listen_ip=0.0.0.0 --tserver_flags="ysql_enable_packed_row=$1,compression_type=$2"
python ~/notes/wide_rows.py --num_write_threads $3 --num_rows_per_thread $4 --num_columns_per_row $5 $6
./bin/yb-ts-cli -server_address=$IP:9100 flush_all_tablets
./bin/yb-ts-cli -server_address=$IP:9100 compact_all_tablets
# Centos 7 dependencies:
# sudo yum install -y postgresql-libs python-psycopg2
#
# For help:
# % python wide_rows.sql -h
#
# please fill out the connect string to connect it to a YugabyteDB instance.
import psycopg2
@kmuthukk
kmuthukk / sql_json_read_write.py
Last active June 8, 2022 18:15
Program to test range scan performance on columns with jsonb payload and varying number of jsonb attributes
# Dependencies:
# On CentOS you can install psycopg2 thus:
#
# sudo yum install postgresql-libs
# sudo yum install python-psycopg2
import psycopg2;
import time
import random
from multiprocessing.dummy import Pool as ThreadPool
# Dependencies:
# On CentOS you can install psycopg2 thus:
#
# sudo yum install postgresql-libs
# sudo yum install python-psycopg2
import psycopg2;
import datetime;
from multiprocessing.dummy import Pool as ThreadPool