* status: new => closed
* resolution: => wontfix
Comment:
> For instance on a PG database with 8800 relations, the query takes 21ms.
As far as I'm aware, tables introspection is extremely fast on PostgreSQL.
This is proven by 21ms for 8800 tables.
> Fixing the migrations recorder to keep the information cached would be a
quick work around this, but it would still execute the long query at least
once, but especially with django-tenant-schema it would end up taking tens
of seconds (at least one call per tenant).
This is cached in Django 5.0+ (ea8cbca579cc6742e119747fc1eb6ecf90638bce.)
> I suggest adding an `table_exists(table_name)` function in
`db.introspection`. Its base implementation could be simply a return
table_name in self.table_names(), but specific DB engines like PostgreSQL
could have an optimized variant.
I don't think it's worth adding for a single (already cached) call.
--
Ticket URL: <https://code.djangoproject.com/ticket/34874#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.