Skip to content

Instantly share code, notes, and snippets.

View FranckPachot's full-sized avatar

Franck Pachot (YB) FranckPachot

View GitHub Profile
@FranckPachot
FranckPachot / Dockerfile
Last active March 14, 2023 11:40
Dockerfile reversed engineered from yugabytedb/yugabyte for almalinux:8
# take the following from the public image: /home/yugabyte /etc/yum.repos.d/CentOS.repo /etc/yum.repos.d/almalinux8.repo /usr/bin/NOTICE.txt /usr/bin/azcopy /usr/local/gsutil
FROM yugabytedb/yugabyte:2.17.1.0-b439 as public_image
# remove those that are re-created later
RUN rm -rf /home/yugabyte/{master,tserver}
FROM almalinux:8
ENV RELEASE=4
ENV USER=root
@FranckPachot
FranckPachot / yb_emp_dept.sql
Last active March 21, 2023 08:49
The EMP and DEPT tables used in the cloud.yugabyte.com tutorial
/* Load from psql:
\! curl -s https://gist.githubusercontent.com/FranckPachot/ec2b586d18965a4571a544c2b862e6a7/raw/fef5faa450ab25949b6bd35f7af9dbc48e89c068/yb_emp_dept.sql > yb_emp_dept.sql
\i yb_emp_dept.sql
*/
drop table if exists emp;
drop table if exists dept cascade;
CREATE TABLE IF NOT EXISTS dept (
@FranckPachot
FranckPachot / oracle_home_unwrap.sql
Created April 6, 2023 13:01
Unwrap Oracle Home package bodies
export PATH=$PATH:$ORACLE_HOME/python/bin
pip install html2text
for f in $(grep -l ' wrapped *$' $(find $ORACLE_HOME -name "*.plb"))
do
curl -s -F "file=@$f" -F "ShowLineNumbers=false" -F "UnwrapFile=Unwrap File" https://www.codecrete.net/UnwrapIt/ |
html2text | awk '
/Unwrap More Code/{p="Y";next}
/Bleichenbacher/{print "--",$0;next}
p=="Y"{gsub(/ʼ/,qq);print}
' qq="'" > ${f}.unwrapped && wc ${f}.unwrapped
@FranckPachot
FranckPachot / joins_scale_on_yuagybte.sql
Last active April 24, 2023 11:32
For the next time you hear that "Joins Don't Scale": Joining to a 7M rows table to return 20K rows with text search filters in 50 milliseconds on @yugabyte​DB and that scales as the plan doesn't depend on the table size😎 SQL databases rocks 🚀
-- load names
\! wget -cO/var/tmp/baby-names.csv "https://github.com/hadley/data-baby-names/blob/master/baby-names.csv?raw=true"
drop table if exists baby_names;
create table baby_names ( year int , name text, percent float, sex text, primary key (name,year, sex));
\copy baby_names from '/var/tmp/baby-names.csv' with ( skip 1, format csv );
-- joins scale
drop table if exists users,messages cascade;
create table users (
primary key (user_id)
<table>
<tbody><tr>
<td>
<strong>MVCC Isolation level</strong>
</td>
<td>
<strong>Serializable Snapshot Isolation</strong>
</td>
<td>
<strong>Snapshot Isolation</strong>
@FranckPachot
FranckPachot / 1brc.sql
Last active January 6, 2024 12:50
1brc in SQL
-- SQL implementation of https://github.com/gunnarmorling/1brc
--
-- get the basic feed data as insert statements in weatherstations.sql
--
/* run in shell to build the 400 lines feed data that was hardcoded in CreateMeasurements.java :
curl -s https://raw.githubusercontent.com/gunnarmorling/1brc/main/src/main/java/dev/morling/onebrc/CreateMeasurements.java | awk '
# Oracle Database # BEGIN{print "begin"} END{ print "end;" ; print "/" }