Skip to content

Instantly share code, notes, and snippets.

@za-arthur
za-arthur / postgres_queries.md
Last active December 20, 2024 10:23
PostgreSQL Queries

Replication lag

$ select application_name,
    pg_size_pretty(pg_wal_lsn_diff(pg_current_wal_lsn(), sent_lsn)) send_lag,
    pg_size_pretty(pg_wal_lsn_diff(sent_lsn, replay_lsn)) replay_lag,
    replay_lag
  from pg_stat_replication;

$ select slot_name, slot_type, active,
    case when not pg_is_in_recovery() then pg_size_pretty(pg_current_wal_lsn() - restart_lsn) end as current_lag_bytes,
@za-arthur
za-arthur / bench_rsocket.py
Last active April 3, 2017 14:03
bench_rsocket
#!/usr/bin/env python
# encoding: utf-8
import argparse
import csv
import datetime
import os
import paramiko
import re
import subprocess
@za-arthur
za-arthur / FTS in nutshell.md
Last active February 21, 2017 15:54
Meetup sai.msu.ru. FTS.

Load dump

psql apod < scripts/apod.dump

Install dictionaries

CREATE EXTENSION hunspell_en_us;
CREATE EXTENSION hunspell_ru_ru;