R
R
reyotor2021-10-10 14:17:01
PostgreSQL
reyotor, 2021-10-10 14:17:01

Why is the data from the database getting slowly?

Please tell me, I use nestjs with typeorm postgresql database, I get data from the database in 150-200ms, but if I wait 20 seconds and send a request to the backend again and get the data, then I get the data in 1000ms or 1500ms, although in theory and in general it should usually be 150-200ms? Used sequelize, same thing. As if if you wait, the server starts to fall asleep and wakes up for a long time when a request is sent to it again. this is how I make a request to the database

async getProducts() {
const products = await this.productRepository.find();
return products;
}

Please tell me any ideas, answers, options why this is happening.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question