Bu yazıyı okumadan önce, ssh ayarlarınızı yaptığınıza emin olun
Bu yazı PostgreSQL 11 ve PgBackRest 2.15 için yazılmıştır
Öncelikle aşağıdaki komut ile pgbackrest kuralım:
sudo apt-get install pgbackrest -y
import sys | |
import pandas as pd | |
json_file = "json_file.json" | |
if __name__ == "__main__": | |
for i, arg in enumerate(sys.argv): | |
if i == 1 and i is not None: | |
csv_file = arg | |
csv_file = pd.DataFrame(pd.read_csv(csv_file, sep = ",", header = 0, index_col = False)) |
68.2.1. Functional Dependencies | |
-- bir tablo | |
CREATE TABLE t (a INT, b INT); | |
-- sıralı veri ekliyoruz ve 2 kolonda birebir aynı | |
INSERT INTO t SELECT i % 100, i % 100 FROM generate_series(1, 10000) s(i); |
--drop table hesap ; | |
create table hesap as SELECT number, round(random()*number)::int para FROM generate_series(1,4000000) number; | |
alter table hesap add column yil int; | |
update hesap set yil=(2000+(round(random()*1000)::int%3)) ; | |
-- drop index in_mmoney; | |
create index in_mmoney on hesap (para); |
--- PSQL queries which also duplicated from https://github.com/anvk/AwesomePSQLList/blob/master/README.md | |
--- some of them taken from https://www.slideshare.net/alexeylesovsky/deep-dive-into-postgresql-statistics-54594192 | |
-- I'm not an expert in PSQL. Just a developer who is trying to accumulate useful stat queries which could potentially explain problems in your Postgres DB. | |
------------ | |
-- Basics -- | |
------------ | |
-- Get indexes of tables |
/usr/pgsql-12/bin/initdb -D 12/rep1 | |
/usr/pgsql-12/bin/initdb -D 12/rep2 | |
printf "port = 6111 \nwal_level = logical\n" >> 12/rep1/postgresql.auto.conf | |
printf "port = 7111 \nwal_level = logical\n" >> 12/rep2/postgresql.auto.conf | |
/usr/pgsql-12/bin/pg_ctl -D 12/rep1 start | |
/usr/pgsql-12/bin/pg_ctl -D 12/rep2 start |
-- create a main table | |
CREATE TABLE test_123 AS SELECT id, md5(random()::text),(id+10) as myid FROM generate_series(1,5000) id; | |
-- create child table | |
CREATE TABLE test_456 AS SELECT id, md5(random()::text) FROM generate_series(11,5010) id; | |
-- check | |
select * from public.test_123; | |
select * from public.test_456; |
package com.kokdemir; | |
import java.io.PrintStream; | |
import java.lang.reflect.InvocationTargetException; | |
import java.lang.reflect.Method; | |
import java.util.Random; | |
import static java.lang.Class.forName; | |
public class Main { |
package com.kokdemir; | |
import java.io.PrintStream; | |
import java.lang.reflect.InvocationTargetException; | |
import java.lang.reflect.Method; | |
import java.util.Random; | |
import static java.lang.Class.forName; | |
public class Main { |
-- base table | |
-- drop table users cascade; | |
CREATE TABLE users ( | |
id serial PRIMARY KEY, | |
username text NOT NULL UNIQUE, | |
password text, | |
created_on timestamptz NOT NULL, | |
last_logged_on timestamptz NOT NULL |