Skip to content

Instantly share code, notes, and snippets.

View uuhnaut69's full-sized avatar
🎯
Focusing

Tuan Nguyen uuhnaut69

🎯
Focusing
View GitHub Profile
@uuhnaut69
uuhnaut69 / multiple_ssh_setting.md
Created December 18, 2022 03:01 — forked from jexchan/multiple_ssh_setting.md
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "your_email@youremail.com"
@uuhnaut69
uuhnaut69 / debezium-installation.adoc
Created July 12, 2022 12:22 — forked from jpsoroulas/debezium-installation.adoc
Debezium installation procedure for PostgreSQL without docker

Debezium installation

version: "3.7"
services:
mongo:
container_name: mongo
image: mongo
volumes:
- ./mongo-init.js:/initiator/mongo-init.js
ports:
- "27017:27017"
@uuhnaut69
uuhnaut69 / README.md
Created February 6, 2021 06:34 — forked from valyala/README.md
Optimizing postgresql table for more than 100K inserts per second

Optimizing postgresql table for more than 100K inserts per second

  • Create UNLOGGED table. This reduces the amount of data written to persistent storage by up to 2x.
  • Set WITH (autovacuum_enabled=false) on the table. This saves CPU time and IO bandwidth on useless vacuuming of the table (since we never DELETE or UPDATE the table).
  • Insert rows with COPY FROM STDIN. This is the fastest possible approach to insert rows into table.
  • Minimize the number of indexes in the table, since they slow down inserts. Usually an index on time timestamp with time zone is enough.
  • Add synchronous_commit = off to postgresql.conf.
  • Use table inheritance for fast removal of old data:
version: "3.7"
services:
zookeeper:
image: confluentinc/cp-zookeeper:6.1.1
hostname: zookeeper
container_name: zookeeper
ports:
- "2181:2181"
@uuhnaut69
uuhnaut69 / create-and-fill-up-table.sql
Created November 19, 2020 08:04 — forked from ololobus/create-and-fill-up-table.sql
Create large ~1 GB random dataset in PostgreSQL
CREATE TABLE large_test (num1 bigint, num2 double precision, num3 double precision);
INSERT INTO large_test (num1, num2, num3)
SELECT round(random()*10), random(), random()*142
FROM generate_series(1, 20000000) s(i);
EXPLAIN (analyse, buffers)
SELECT num1, avg(num3) as num3_avg, sum(num2) as num2_sum
FROM large_test
GROUP BY num1;
@uuhnaut69
uuhnaut69 / Vagrantfile
Created November 19, 2020 08:03 — forked from kikitux/Vagrantfile
Vagrantfile, multi machine with ssh password less and hostname over private network.
numnodes=2
baseip="192.168.10"
#global script
$global = <<SCRIPT
#check for private key for vm-vm comm
[ -f /vagrant/id_rsa ] || {
ssh-keygen -t rsa -f /vagrant/id_rsa -q -N ''
}

Get Started

Master configuration

Setup Ubuntu Bionic 18.04

vagrant init ubuntu/bionic64

Get Started for Mac OS

Install Vagrant

Download & install vagrant here.

Start Vagrant

mkdir example && cd example 
vagrant init centos/7 

postgres-roaring-bitmap-extension-installation-note

A note about installtion roaring bitmap extension for Postgres. This tutorial using for Postgres App

Installation

  • Install Postgres App (ver 10, 11, 12)

  • Go to directory Postgres App location (The url maybe difference depend on your installation by homebrew or using Postgres App)