Database (13) 썸네일형 리스트형 PostgreSQL: query 기록하고 보기 - table(view)로 보기 # ORM # raw query # extension # pg_stat_statements orm으로 query를 작성한 경우, orm이 실제 query로 어떻게 변했는지를 파악하고 싶을 때가 있다. PostgreSQL의 경우 실제 query를 table 형태로 저장해서 보도록 하자 OS: ubuntu 22.04 기준 1. postgresql.conf 에 shared_preload_libraries를 찾아서 주석을 풀고 다음과 같이 적자 ubuntu 기준 기본 postgresql.conf 위치: /etc/postgresql/[VERSION]/main/postgresql.conf 더보기 shared_preload_libraries = 'pg_stat_statements' 2. 쭉 내려서 아래에 다음도 추가 더보기 pg_stat_statements.track = all pg_stat_stateme.. DB Table 모두 지우고 리셋 # schema DB의 schema schema란 데이터베이스의 구조, 제약조건에 관한 전반적인 명세를 기술한 메타데이터의 집합 메타데이터? 일반적으로 저장될 데이터를 아울러서(초월해서) 적용될 데이터. DB에서는 모든 테이블들에 적용될 데이터(Rule)라고 보면 됨 - 쉽게 말해서 어떤 테이블의 필드를 Date값으로 받을지, Boolean 값으로 받을지 등의 조건을 명세한 데이터의 집합 -> 이러한 메타데이터의 집합이 그 DB의 Rule이 된다. -> Rule에 위반되는 데이터는 받을 수 없다고 보면 도니다. Rule에 위반되는 데이터는 입력을 받을 수 없다. 따라서 이미 규정한 schema와 다른 형태로 DB에 마이그레이션 해야할 때 Rule이 달라서 안되는 경우가 있다. DB의 데이터들을 날려도 되는 경우라면, 간.. PostgreSQL install ~ begin with Django: Linux(Ubuntu) WSL 환경에서 실행 (Ubuntu 22.04) Install $ sudo apt update $ sudo apt install postgresql postgresql-client $ systemctl status postgresql DB 생성 $ sudo -u postgres createdb mydatabase -u 옵션으로 user 선택, postgesql의 default user인 postgres로 실행 오류 발생: could not change directory to "/home/user": permission denied 해결책: $ sudo chmod 755 /home/user 위 명령어로 postgres user에게 /home/user directory 에 대해서 읽고 쓸 권한을 줍니다. 저.. PostgreSQL Tutorial 사이트 https://www.postgresqltutorial.com/ PostgreSQL Tutorial - Learn PostgreSQL from Scratch Welcome to the PostgreSQLTutorial.com website! This PostgreSQL tutorial helps you understand PostgreSQL quickly. You’ll master PostgreSQL very fast through many practical examples and apply the knowledge in developing applications using PostgreSQL. If yo www.postgresqltutorial.com 다양한 언어에서 설치부터 트랜잭션까지 차근차근 공부.. PostgreSQL install ~ begin : Windwos 설치https://www.enterprisedb.com/downloads/postgres-postgresql-downloads Download PostgreSQLPostgreSQL Database Downloadwww.enterprisedb.com저는 Windows 사용자로 최신버전인 15.1 version을 설치했습니다.설치 하다보면 중간에비밀번호를 설정하라고 합니다.추후에 DB에 접속할 때 비밀번호이니 까먹지 말고 잘 기억해 둡시다! GUI도 활용하실 분은 pgAdmin 도 함께 설치 해주시면 됩니다.stack builder는 처음에는 활용도가 낮으니 패스 해도 될것 같습니다. 실행참고: https://www.postgresqltutorial.com/postgresql-getting-started/c.. 이전 1 2 다음