This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Set number of shard | |
ALTER DATABASE citus SET citus.shard_count = 64; | |
-- distribute the table | |
SELECT create_distributed_table('github_events', 'repo_id'); | |
-- undo that and make it local again | |
SELECT undistribute_table('github_events'); | |
-- change distribution column |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo apt update | |
sudo apt upgrade | |
sudo apt install -y zsh neovim | |
## set ecs-user / hellogpdb | |
sudo passwd ecs-user | |
## make ecs can access github | |
sudo bash -c bash | |
echo "140.82.114.4 github.com" >> /etc/hosts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE customer_zlib ( | |
c_custkey integer NOT NULL, | |
c_name character varying(25) NOT NULL, | |
c_address character varying(40) NOT NULL, | |
c_nationkey integer NOT NULL, | |
c_phone character(15) NOT NULL, | |
c_acctbal numeric(15,2) NOT NULL, | |
c_mktsegment character(10) NOT NULL, | |
c_comment character varying(117) NOT NULL | |
) with (appendoptimized=true, compresstype=zlib, orientation=column) distributed by (c_custkey); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE customer_zstd ( | |
c_custkey integer NOT NULL, | |
c_name character varying(25) NOT NULL, | |
c_address character varying(40) NOT NULL, | |
c_nationkey integer NOT NULL, | |
c_phone character(15) NOT NULL, | |
c_acctbal numeric(15,2) NOT NULL, | |
c_mktsegment character(10) NOT NULL, | |
c_comment character varying(117) NOT NULL | |
) with (appendoptimized=true, compresstype=zstd, orientation=column) distributed by (c_custkey); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE customer_lz4 ( | |
c_custkey integer NOT NULL, | |
c_name character varying(25) NOT NULL, | |
c_address character varying(40) NOT NULL, | |
c_nationkey integer NOT NULL, | |
c_phone character(15) NOT NULL, | |
c_acctbal numeric(15,2) NOT NULL, | |
c_mktsegment character(10) NOT NULL, | |
c_comment character varying(117) NOT NULL | |
) with (appendoptimized=true, compresstype=lz4, compresslevel = 1, orientation=column) distributed by (c_custkey); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
create extension pg_buffercache; | |
-- 查看哪个数据库占用的缓存最多 | |
select datname, count(*), count(*) filter (where isdirty = true) as dirty | |
from pg_buffercache as b, pg_database as d | |
where d.oid = b.reldatabase | |
group by rollup (1); | |
-- 查看指定数据库中哪张表占用的缓存最多 | |
select relname, relkind, count(*), count(*) filter (where isdirty = true) as dirty |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MaxNumString { | |
public int Continumax(String intputStr, StringBuffer outputStr){ | |
int maxlength=0; | |
StringBuffer maxNumberStr = null; | |
int nowlength=0; | |
StringBuffer nowNumberStr = null; | |
for(int i=0;i<intputStr.length();i++){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
public class Jiepijiu { | |
public static void main(String [] args) { | |
int w[] = new int[10010]; | |
int lastw[] = new int[10010]; | |
Scanner scanner = new Scanner(System.in); | |
int n = scanner.nextInt(); | |
int m = scanner.nextInt(); | |
int time = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.ArrayList; | |
import java.util.List; | |
import java.util.Scanner; | |
public class Josephus { | |
public static List<Integer> getResult(int n, int m) { | |
List<Integer> circle = new ArrayList<>(); | |
for (int i = 1; i <= n; i++) { | |
circle.add(i); |
NewerOlder