I'm using NestJS framework with TypeORM and PostgreSQL. Let's say I have a simple User entity which has only two properties: id and name
@Entity()
class User {
@PrimaryGeneratedColumn()
id: string;
@Column({
type: 'varchar'
})
name: string;
Questions:
Is
usersRepository.findOne(id)faster thanusersRepository.findOne({ id })?I assume that
usersRepository.findOne(id)will be faster thanusersRepository.findOne({ name })sincenameis not in index, won't it?