Skip to main content

Special setter method in association of postgres is taking too long

Lists.belongsTo(Users, { foreignKey: "creator_id", as: "creator" });    
let payload= { ...newTask };   
res = await Lists.create(payload);    
await res.setCreator(userId);

here after the creation of a row, the setCreator function takes 20-30s to execute. Why is it so slow? how to optimize it?

I tried using raw queries to update the row.

tried directly inserting the creator_id in the payload but it still is slow.

Via Active questions tagged javascript - Stack Overflow https://ift.tt/7LWhoCQ

Comments