Skip to content

Tag: postgresql

update average/count from another table

I’ve been provided the below schema for this problem and I’m trying to do two things: Update the ACCOUNT table’s average_eval row with the average of the evaluation row from the POST_EVAL table per account_id. Update the ACCOUNT table with a count of the number of posts per account_id, with …

Need help understanding Postgresql query execution

I have a generated query from an ORM that selects data from a nested join on a junction table. When executing it looks like it performs a full table scan on a table with >55 million records resulting in a slow execution time. My expectation was that it would perform the filtering first then lookup by index…

Add a new column from compare result

I need add a new column (status) on my main table (Table 1) on my bd Postgres, to do this , I need to compare two columns from table 1 on table 2 , if the two columns exist , I need to copy the status from table 2 to the new column on table 1 , if not exist