I have no problem using the DB Manager in QGIS 2.18, but if I try to add a layer based on a long running query (1 min+), QGIS becomes entirely unusable. It would appear that every map pan, every mouse click, etc., is triggering some kind of layer refresh.
This seems silly for one, especially given that you can right click the layer and request a refresh. And more important, it makes the application unusable. What am I doing wrong here? Is it not possible to create the layer and only have it update when requested?
Obviously I can create materialized views in postgres for all the spatial queries, but that seems to defeat the point of being able to do it in QGIS
Unfortunately the repaintRequested() signal is not triggered refreshing the canvas so I write a little python function that you can paste in QGIS python console editor to generate a materialized view from a query and add to mapcanvas as layer on the fly adding an action to legend menu for refreshing and reloading the view on demand