Skip to content

Instantly share code, notes, and snippets.

View msdousti's full-sized avatar

Sadeq Dousti msdousti

View GitHub Profile
import matplotlib.pyplot as plt
import numpy as np
# Provided data
data = [
5, 18, 32, 40, 54, 68, 80, 100, 110, 119, 125, 136, 144, 149, 154, 160, 165,
171, 178, 182, 189, 195, 202, 211, 216, 222, 227, 234, 239, 245, 250, 256,
261, 268, 273, 278, 283, 289, 295, 301, 307, 314, 320, 325, 332, 339, 346,
352, 358, 364, 370, 376, 383, 389, 396, 402, 409, 415, 422, 429, 436, 443,
450, 458, 466, 473, 481, 489, 496, 503, 511, 519, 527, 536, 545, 555, 564,
* explain.h all over the place
* saving query plan before executing it (execMain.c)
* performance?
* GUC to enable?
* TAP tests
* pg_stat_session --> "One row per client backend"
--> should the name indicate this, e.g. pg_stat_client_backend
* Information is scattered between pg_stat_activity and this view, requiring join
* Example: client_addr, application_name, usename
* Can we define this outside the function pg_stat_get_session?
#define PG_STAT_GET_SESSION_COLS 9
create table t (
id bigint generated always as identity not null,
created_at timestamptz not null)
partition by range (created_at);
create index t__id__created_at__idx
on t(id, created_at);
-- partition for next month
import sys
def join_paragraph_lines(input_text):
paragraphs = input_text.strip().split('\n\n')
joined_paragraphs = []
for paragraph in paragraphs:
lines = paragraph.splitlines()
sep = ''

src/backend/access/nbtree/README

Btree Indexing

This directory contains a correct implementation of Lehman and Yao's high-concurrency B-tree management algorithm (P. Lehman and S. Yao, Efficient Locking for Concurrent Operations on B-Trees, ACM Transactions on Database Systems, Vol 6, No. 4, December 1981, pp 650-670). We also use a simplified version of the deletion logic described in Lanin and Shasha (V. Lanin and D. Shasha, A Symmetric Concurrent B-Tree Algorithm, Proceedings of 1986 Fall Joint Computer Conference, pp 380-389).

The basic Lehman & Yao Algorithm

#!/usr/bin/env bash
set -euo pipefail
# Define default commands
COMPILE_CMD="./mvnw compile"
PACKAGE_CMD="./mvnw package -DskipTests -pl logbook-servlet -am"
VERIFY_CMD="./mvnw verify -B"
INSTALL_CMD="./mvnw install -DskipTests -Djacoco.skip=true"
# Flags to track selected options
create table my_outbox
(
id serial,
data jsonb not null,
created timestamp with time zone default now() not null,
primary key (id, created)
);
insert into my_outbox (data, created)
values ('{"a": 1}'::jsonb, default),
create table test
as
select id, random() > 0.5 as to_be
from generate_series(1, 10000000) as id;
CREATE INDEX IF NOT EXISTS idx_1
ON test (id)
WHERE to_be = true;
CREATE INDEX IF NOT EXISTS idx_2
#!/bin/bash
users=("cantony" "hadmohammadi" "helseoudy" "mmorsy" "mtaufikakbar" "pebermann" "rogupta" "sdousti" "tschlage" "yzykau")
token=`ztoken`
for user in ${users[*]}; do
has_role=$(curl -sH "Authorization: Bearer $token" https://users.auth.zalando.com/api/employees/$user/groups | jq '.[] | select(.dn | contains("24x7 Emergency,ou=Retail Operations")) | length > 0')
echo "$user: $has_role"
done