Too numerous calls to information_schema while handling the backend tables
When dealing with a database we notice that a lot of calls to the information_schema
tables are made.
This could have a huge impact because sometimes postgresql's requests to those table have some bad cases.
First and foremost, there is an issue with the signature of the _update_definitions
.
An analysis of the requests on the update of a demo database shows that there is a lot of queries on constraint tables. (I identified three types of calls to information_schema
table in the postgres backend and it resulted in the following figures: Calls: Counter({'table_constraints': 8417, 'fk': 7637, 'columns': 1134})
).
After fixing this issue I noticed that another source of extraneous queries is the way we define the id
columns. For tables containing an hyphen, the comparison of the results of the query and our expection fails due to quoting. I wonder if we shouldn't use the postgres IDENTITY
column as they recommend since it's available in all supported versions of postgres.