Skip to content

Instantly share code, notes, and snippets.

View sihar's full-sized avatar

Sihar Simbolon sihar

  • Indonesia
View GitHub Profile
@sihar
sihar / soft_delete_postgres.sql
Created October 4, 2025 01:51 — forked from kendru/soft_delete_postgres.sql
Example of transparent soft-deletes in Postgres
create table widget_history (
id bigint generated always as identity,
name text not null,
created_at timestamp not null default current_timestamp,
deleted_at timestamp
);
create index widget_by_name on widget_history(name) where deleted_at is null;
create view widget as
tail -n 1000 -F /var/log/nginx/access.log | awk '{gsub(/\[|\]/, "", $4); split($4, a, ":"); print a[2]":"a[3]":"a[4]}' | uniq -c
@sihar
sihar / tuned.conf
Created September 20, 2022 03:23
Tuned profile for PostgreSQL server on CENTOS-7
#
# tuned configuration for PostgresSQL servers
# /usr/lib/tuned/postgres-db-server/tuned.conf
#
[cpu]
force_latency=1
governor=performance
energy_perf_bias=performance
min_perf_pct=100