Skip to content

Instantly share code, notes, and snippets.

View igrishaev's full-sized avatar

Ivan Grishaev igrishaev

View GitHub Profile
explain analyze
select id, doc from applications
where
(doc->>'status') = 'active'
and (doc->>'credit_type') = 'org'
and (doc->>'assigned_to') = 'user_999@test.com';
┌──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ QUERY PLAN │
├──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
# RUN mvn dependency:copy -Dartifact=org.duckdb:duckdb_jdbc:1.4.3.0 -DoutputDirectory=/duckdb
# USER root
# RUN ls -l /root/.m2/repository/org/duckdb/duckdb_jdbc/1.4.3.0
# RUN jar xf /root/.m2/repository/org/duckdb/duckdb_jdbc/1.4.3.0/duckdb_jdbc-1.4.3.0.jar libduckdb_java.so_linux_amd64
# RUN mkdir -p /var/task
# RUN mv libduckdb_java.so_linux_amd64 /var/task/
(deftype MM [-form]
Object
(toString [_this]
(str -form)))
(defmacro mm [form]
`(new MM '~form))
create table app1 (
id uuid primary key,
doc jsonb compression lz4 not null,
created_at timestamptz not null default current_timestamp,
updated_at timestamptz
);
create table app2 (
id uuid primary key,
doc jsonb compression lz4 not null,
@igrishaev
igrishaev / demo.clj
Created April 13, 2026 09:22
semaphore demo
(defn wrap-parallel [f n]
(let [-sem (new java.util.concurrent.Semaphore (int n))]
(fn [& args]
(.acquire -sem)
(try
(apply f args)
(finally
(.release -sem))))))
(def wrapped
0.1
0.0(0011)
1.1001100110011001100110011001100110011 e-4
-4+127 = 123
0 1111011 10011001100110011001100 11001100110011
0 1111011 10011001100110011001101
0.2
0.(0011)
(ns consolidation.main
(:gen-cla
@igrishaev
igrishaev / demo.sql
Last active February 11, 2026 07:35
create table users (
id serial primary key
);
create table profiles (
id serial primary key,
user_id integer not null references users(id)
);
insert into users
create table goods (
id serial primary key,
title text not null,
created_at timestamptz not null default current_timestamp
);
insert into goods(title)
select
format('good_%s', x)
create table tree(
id text primary key,
parent_id text null
);
insert into tree values
('a', null),
('b', 'a'),
('c', 'a'),
('d', 'b'),