I am building a json API using express (well, maybe will move to koa). I store my data in PostgreSQL database, and i use pg-promise to fetch data from it (async/await via babel).
I am totally new to node.js and i can't find any information about performance measurement in that environment.
To be specific:
module.exports.get_hierarchy = async function () {
const rows = await postgres.any('SELECT id, parent, title, permission FROM heading');
var result = [];
// some black magic goes here...
return result;
}
I want to know (programmatically if possible) how much time SELECT consumes. (Not the time promise lives from constructing to resolving, which can be achieved by taking two timestamps, but actual time consumed by the DB server to process query).
Can this be achieved? If so, how?
pgAdminUI ;)