I was trying out drizzle, using a PostgreSQL database (v15). I experience a huge performance issue just querying one row of a table with just one row. So I dig a little deeper inside the code and found out that it internally calls the query method of the Client class. I also tried to call the query method of the Client class with a plain query text/string which resulted in a way faster performance. I was able to reproduce everything using the plain pg module:
const pg = new Client({
connectionString: configuration.get('DATABASE_URL')
});
pg.connect();
const config = {
text: 'select count(*) as count from matcher.swipes where id = $1',
rowMode: 'array'
}
const result = await pg.query(config, ['3a1ec2e5-41b9-4866-a210-f5102f66ca4d'])
This pg.query call takes 40-50ms!
const result = await pg.query("select count(*) as count from matcher.swipes where id = '3a1ec2e5-41b9-4866-a210-f5102f66ca4d';")
This pg.query call takes 2-3ms
By downgrading over and over again I found out that version 8.1.0 is the last version that produces the same timing results for both query calls. Now I wonder what I am missing here. I wonder what I am doing wrong and why it seems to only be me having this problem...
I was trying out drizzle, using a PostgreSQL database (v15). I experience a huge performance issue just querying one row of a table with just one row. So I dig a little deeper inside the code and found out that it internally calls the
querymethod of theClientclass. I also tried to call thequerymethod of theClientclass with a plain query text/string which resulted in a way faster performance. I was able to reproduce everything using the plain pg module:This
pg.querycall takes 40-50ms!This
pg.querycall takes 2-3msBy downgrading over and over again I found out that version
8.1.0is the last version that produces the same timing results for bothquerycalls. Now I wonder what I am missing here. I wonder what I am doing wrong and why it seems to only be me having this problem...