Open jpmckinney opened 10 months ago
Note that creating automatic migrations incorrectly detects nullable changes. These seem to be fixed in more recent 1.4.x versions of SQLAlchemy, but we need SQLModel to release 0.0.9 to unpin SQLAlchemy: https://github.com/tiangolo/sqlmodel/issues/434#issuecomment-1775601658
Can maybe start with the slow queries listed at https://open-contracting-partnership.sentry.io/performance/?project=4505799907672064&statsPeriod=14d
For single-column indexes, would need to add
index=True
toField()
calls to add these indexes.Not sure if https://sqlmodel.tiangolo.com supports composite indexes. Might need to do SQLAlchemy or Alembic directly.
JOIN
Found using:
WHERE
Found using these regexes:
To avoid a ton of indexes, I grouped some WHERE matches under one composite index.
Application
ApplicationAction
Award
Borrower
borrower_identifier: get_borrower()(already hasunique=True
)BorrowerDocument
CreditProduct
Message
User
email: login(), login_mfa()(already hasunique=True
)get_general_statistics() and get_msme_opt_in_stats() have a lot of filters, but not sure how important to optimize these functions. I didn't add some from statistics.py or update_statistic.py.
I think the queries in application_utils.py are too complex for an index.