We've large tables and unfortunately the analyze_constraints() function is taking longer and longer!
We're doing every hour bulk data loading and afterwards verifying the data with the analyze_constraints() function.

Is there some kind of best practice, how I can do this more efficiently?
Just to analyze the data that is supposed to be uploaded and not the complete table every time.

Thanks in advance!


  • Options
    What constraints do you have defined?  I'll guess that it's a primary key and that the time is being spent checking for uniqueness.  If you EXPLAIN the analyze_constraints() you can see the query plan.   You can optimize the primary key check by optimizing for that GROUP BY - it may mean adding another pair of projections depending on what your current projections optimize for.


Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file