Database 3

where 대신 join을 사용하는 경우

최근 아는 개발자 분께 질문을 드리다 여러 데이터를 가져올 때는 where 문보다 join 문의 성능이 더 좋을 수 있다는 것을 알게 되었다. 기존 query 기존에 프로젝트를 진행하면서 특정 유저의 콘텐츠를 조회할 때, 해당 user와 content 테이블은 서로 1 : N의 관계로 연결되어있었기 때문에 user의 id를 where 조건문에 사용하여 content 테이블에 query를 날려 데이터를 조회하고 있었다. 코드의 일부분을 보여주자면 다음과 같다. await this.contents .createQueryBuilder('content') .where('content.userId = :userId', { userId: user.id }) .leftJoinAndSelect('content.cate..

Dev 2023.04.15

TypeORM - 버전 0.3 && ORM이란?

지금까지 typeORM 0.2.45 버전을 사용 중이었다. 최근 0.3.4까지 업데이트가 되며 확인을 해보았더니 정말 많은 변화가 있었다. https://github.com/typeorm/typeorm/blob/master/CHANGELOG.md GitHub - typeorm/typeorm: ORM for TypeScript and JavaScript (ES7, ES6, ES5). Supports MySQL, PostgreSQL, MariaDB, SQLite, MS SQL ORM for TypeScript and JavaScript (ES7, ES6, ES5). Supports MySQL, PostgreSQL, MariaDB, SQLite, MS SQL Server, Oracle, SAP Hana, We..

Dev 2022.03.28

Heroku로 백엔드 배포하기

어느 정도 프로젝트를 진행하다가 우선 배포를 한번 진행하면서 에러를 체크하고 싶다는 생각이 들었다. 그래서 바로 실행에 옮겼다. NestJS Documentation | NestJS - A progressive Node.js framework Nest is a framework for building efficient, scalable Node.js server-side applications. It uses progressive JavaScript, is built with TypeScript and combines elements of OOP (Object Oriented Progamming), FP (Functional Programming), and FRP (Functional Reac docs...

개발 일지 2022.03.17