row 수는 pages에 영향을 받지만 실질적으로 무제한에 가까울듯 하고

column 수도 single page에 영향을 받아서 1600 이라고는 하지만 그것보다 적을수 있다고 하니

은근히 계산이 까다로울 듯.. 한 페이지가 얼마냐.. -_-

 

Table K.1. PostgreSQL Limitations

ItemUpper LimitComment

database size unlimited  
number of databases 4,294,950,911  
relations per database 1,431,650,303  
relation size 32 TB with the default BLCKSZ of 8192 bytes
rows per table limited by the number of tuples that can fit onto 4,294,967,295 pages  
columns per table 1600 further limited by tuple size fitting on a single page; see note below
field size 1 GB  
identifier length 63 bytes can be increased by recompiling PostgreSQL
indexes per table unlimited constrained by maximum relations per database
columns per index 32 can be increased by recompiling PostgreSQL
partition keys 32 can be increased by recompiling PostgreSQL

The maximum number of columns for a table is further reduced as the tuple being stored must fit in a single 8192-byte heap page. For example, excluding the tuple header, a tuple made up of 1600 int columns would consume 6400 bytes and could be stored in a heap page, but a tuple of 1600 bigint columns would consume 12800 bytes and would therefore not fit inside a heap page. Variable-length fields of types such as text, varchar, and char can have their values stored out of line in the table's TOAST table when the values are large enough to require it. Only an 18-byte pointer must remain inside the tuple in the table's heap. For shorter length variable-length fields, either a 4-byte or 1-byte field header is used and the value is stored inside the heap tuple.

Columns that have been dropped from the table also contribute to the maximum column limit. Moreover, although the dropped column values for newly created tuples are internally marked as null in the tuple's null bitmap, the null bitmap also occupies space.

[링크 : https://www.postgresql.org/docs/12/limits.html]

 

[링크 : https://link.springer.com/content/pdf/bbm%3A978-1-4302-0018-5%2F1.pdf]

[링크 : https://soapware.screenstepslive.com/.../22071-q-what-is-the-postgresql-database-top-capacity]

'프로그램 사용 > postgreSQL' 카테고리의 다른 글

postgres table의 물리적 용량 확인하기  (0) 2020.01.13
sql combination 생성하기  (0) 2020.01.13
pgmodeler  (0) 2020.01.05
스칼라 서브쿼리(scalar subquery)  (0) 2020.01.04
array_cat()  (0) 2019.12.30
Posted by 구차니

대충 만져보는데.. ctgov에서 export한 형상이 이걸로 만든건가 싶네?

[링크 : https://aact.ctti-clinicaltrials.org/schema]

 

아무튼.. constraints를 걸지 않고 바로 그릴수는 없는지 찾는데 잘 보이진 않네..

[링크 : https://pgmodeler.io/]

'프로그램 사용 > postgreSQL' 카테고리의 다른 글

sql combination 생성하기  (0) 2020.01.13
postgres limits - max capacity  (0) 2020.01.10
스칼라 서브쿼리(scalar subquery)  (0) 2020.01.04
array_cat()  (0) 2019.12.30
테이블 내 두 컬럼 값 바꾸기(임시 변수)  (0) 2019.12.24
Posted by 구차니

말은 거창한데.. SELECT * FROM

에서 * 부분에 쓰는 한줄짜리 리턴하는 서브쿼리이다.

 

[링크 : https://ttend.tistory.com/623]

'프로그램 사용 > postgreSQL' 카테고리의 다른 글

postgres limits - max capacity  (0) 2020.01.10
pgmodeler  (0) 2020.01.05
array_cat()  (0) 2019.12.30
테이블 내 두 컬럼 값 바꾸기(임시 변수)  (0) 2019.12.24
left join이 능사는 아니다  (0) 2019.12.24
Posted by 구차니

concat() 함수와는 다르게 피연산자가 2개 뿐인 함수이다.

대신 null 값들을 array_cat()으로 합치면 null이 나와서 좀 편리하다.

 

[링크 : https://www.postgresql.org/docs/9.1/functions-array.html]

'프로그램 사용 > postgreSQL' 카테고리의 다른 글

pgmodeler  (0) 2020.01.05
스칼라 서브쿼리(scalar subquery)  (0) 2020.01.04
테이블 내 두 컬럼 값 바꾸기(임시 변수)  (0) 2019.12.24
left join이 능사는 아니다  (0) 2019.12.24
dense_rank()  (0) 2019.12.22
Posted by 구차니

mysql만 되는건가?

 

[링크 : https://blog.naver.com/thesims1004/220360410840]

'프로그램 사용 > postgreSQL' 카테고리의 다른 글

스칼라 서브쿼리(scalar subquery)  (0) 2020.01.04
array_cat()  (0) 2019.12.30
left join이 능사는 아니다  (0) 2019.12.24
dense_rank()  (0) 2019.12.22
postgresql 의 반복문을 이용한 문자열 치환하기  (0) 2019.12.20
Posted by 구차니

아무생각 없이 inner join은 교집합

left join은 왼쪽 영역대로 쓰는 거라고 생각을 해서 수가 변하지 않을꺼라고 생각했는데

간간히 늘어나는 경우가 있어 이해를 못하고 distinct나 group by로 억제(!) 했었는데

이런 발상 자체가 데이터 다루는 관점에서는 너무나 무책임하고 위험하다는걸 이제야 깨달음

 

아무튼.. 1:N 관계의 테이블을 left join 하면 행이 뻥튀기 된다.

반대로 말하면 left join 전에는 반드시 1:1 관계인지 확인을 해야 하고

최소한 1:N은 아닌것을 확인하고 N:1이거나 1:1 인지 확인하고 써야 한다.

 

[링크 : https://brunch.co.kr/@qqplot/22]

[링크 : https://okky.kr/article/303538]

'프로그램 사용 > postgreSQL' 카테고리의 다른 글

array_cat()  (0) 2019.12.30
테이블 내 두 컬럼 값 바꾸기(임시 변수)  (0) 2019.12.24
dense_rank()  (0) 2019.12.22
postgresql 의 반복문을 이용한 문자열 치환하기  (0) 2019.12.20
postgresql loop 반복문  (0) 2019.12.20
Posted by 구차니

row_number()로 하면 무조건 등수가 생기는데

동일 값을 가지는 부분을 묶어서 1,2,3 이런식으로 group 등수를 매기기 위해서는

row_number() 대신

dense_rank()를 쓰면 되는 듯?

 

[링크 : https://ahrang.tistory.com/10]

Posted by 구차니

정상작동 되는지 전체가 들어간지는 아직 몰라서 확인이 필요함.

예전에 3 letter를 1letter로 replace를 이용한 건 편리했는데

1letter를 3letter로 바꾸는건 오류가 있어서 못쓰다가, 이번에 반복문을 이용해서 한번 시도해 봄

 

DO $$ 
DECLARE
   hgvspthreeletter text := 'Thr790Met';
   hgvsponeletter text := 'T790Mfs';
   hgvslen integer := length(hgvsponeletter);
   i	integer := 1;
   result	text;
   conv		text;
   res		text;
BEGIN 

--    RAISE NOTICE '%의 길이는 %이며 원래는 % 임', 
--        hgvsponeletter, hgvslen, hgvspthreeletter;

while i<= hgvslen loop
	select substring(hgvsponeletter, i, 1) into result;
	 SELECT i+1 INTO i;
	SELECT case 
		when result = 'A' then 'Ala'
		when result = 'B' then 'Asx'
		when result = 'C' then 'Cys'
		when result = 'D' then 'Asp'
		when result = 'E' then 'Glu'
		when result = 'F' then 'Phe'
		when result = 'G' then 'Gly'
		when result = 'H' then 'His'
		when result = 'I' then 'Ile'
		when result = 'J' then 'Xle'
		when result = 'K' then 'Lys'
		when result = 'L' then 'Leu'
		when result = 'M' then 'Met'
		when result = 'N' then 'Asn'
		when result = 'O' then 'Pyl'
		when result = 'P' then 'Pro'
		when result = 'Q' then 'Gln'
		when result = 'R' then 'Arg'
		when result = 'S' then 'Ser'
		when result = 'T' then 'Thr'
		when result = 'U' then 'Sec'
		when result = 'V' then 'Val'
		when result = 'W' then 'Trp'
		when result = 'X' then 'X'
		when result = 'Y' then 'Tyr'
		when result = 'Z' then 'Glx'
		when result = '*' then 'Ter' -- '*'
		else result
	end INTO conv;
	SELECT concat(res, conv) into res;
-- 	raise notice '% %' ,conv,res;
	end loop;
	
	raise notice '%' ,res;
END $$;

 

알림: Thr790Metfs

DO

Query returned successfully in 72 msec.

 

[링크 : https://www.hgvs.org/mutnomen/codon.html]

[링크 : http://www.gisdeveloper.co.kr/?p=4621]

[링크 : http://www.gisdeveloper.co.kr/?p=4573]

[링크 : https://w3resource.com/PostgreSQL/substring-function.php]

'프로그램 사용 > postgreSQL' 카테고리의 다른 글

left join이 능사는 아니다  (0) 2019.12.24
dense_rank()  (0) 2019.12.22
postgresql loop 반복문  (0) 2019.12.20
sql array any all  (0) 2019.12.20
postgres 동일 컬럼명 에러  (0) 2019.12.20
Posted by 구차니

디버깅 방법은 좀 찾아 봐야겠지만..

일단 텍스트에 대해서 length로 반복 횟수를 정하고

substr()로 특정 위치의 값 하나를 빼내서

다른 변수에 치환해서 넣어주면 원하는 기능을 구현을 할 수 는 있을 것으로 보인다.

 

[링크 : http://www.gisdeveloper.co.kr/?p=4573] <<

[링크 : http://www.gisdeveloper.co.kr/?p=4621]

[링크 : http://www.postgresqltutorial.com/plpgsql-loop-statements/]

 

'프로그램 사용 > postgreSQL' 카테고리의 다른 글

dense_rank()  (0) 2019.12.22
postgresql 의 반복문을 이용한 문자열 치환하기  (0) 2019.12.20
sql array any all  (0) 2019.12.20
postgres 동일 컬럼명 에러  (0) 2019.12.20
sql scan과 index  (0) 2019.12.19
Posted by 구차니

배열내의 내용을 검색하는 거라고 들었지만

실제로 내용을 보면 그런 용도와는 좀 다른 느낌.

 

[링크 : https://www.w3schools.com/sql/sql_any_all.asp]

[링크 : https://stackoverflow.com/questions/34627026/in-vs-any-operator-in-postgresql]

Posted by 구차니