On Sun, 26 May 2019 at 01:48, Régis Haubourg <regis.haubo...@gmail.com> wrote: > > Hi, Thanks Nyall for the hints. > > I'm considering switching to this query instead. > SELECT * FROM pg_class WHERE relname='qgis_editor_widget_styles' > > In my setup it access only to one table and uses internal indexes, when the > information_schema.tables is a view that involve a materialized query here > when using explain. > I don't see a significant difference on my local setup, I'll test it on our > customer setup before starting my (first) PR!
I think this could be potentially further optimised (e.g. with a "LIMIT 1"), but I'd see how this goes on the troublesome setup first... no point over-optimising if your query fixes the issue. Nyall > > Cheers > Régis > > Le sam. 25 mai 2019 à 05:33, Nyall Dawson <nyall.daw...@gmail.com> a écrit : >> >> On Fri, 24 May 2019 at 18:25, Régis Haubourg <regis.haubo...@gmail.com> >> wrote: >> > >> > Hi all, >> > I'm facing very slow opening of project files for a customer here in QGIS >> > 3.4.5. Something like 7 minutes, against 30 s in QGIS 2.18. >> > >> > We are still investigating to narrow it down, but I faced a first query in >> > the logs that I fail to understand. >> > >> > QGIS emits this at a point: >> >> > >> > And this query is long in our context, 1.7s, because of a very high number >> > of tables and schemas in that production DB. >> > >> > I found at [0] in the postgres provider where it comes from, I found the >> > associated PR [1], but I fail to understand in what workflow this table is >> > created using QGIS, and what it is used for. >> > >> > Can someone put some light here ? >> >> There's a unit test at >> >> https://github.com/qgis/QGIS/pull/3439/files#diff-99b101819133a316786604243f3abf6eR318 >> >> and >> >> https://github.com/qgis/QGIS/pull/3439/files#diff-03e6d7f6f76fb4bcab508984d0fd05f6R443 >> >> which partially explains this -- it looks like it's a way to specify a >> default editor widget configuration for a table, which is used >> whenever that table is loaded into QGIS. >> >> > >> > select count(*) >> > >> > from information_schema.tables >> > >> > where table_name = 'qgis_editor_widget_styles' ; >> > >> >> Looks like that query could be substantially improved -- it's only >> testing for existence of the table, so calculating the count is >> inefficient and requiring a whole table scan. >> >> Nyall _______________________________________________ QGIS-Developer mailing list QGIS-Developer@lists.osgeo.org List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer