I am running QGIS Desktop 3.18.2 on Ubuntu, but I have observed this issue on other operating systems.
When I query a relatively small table (~300 simple polygons) from PostGIS on a remote server, it takes time to load the data as a layer through the DB Manager. When the data are loaded as a "QueryLayer", zooming in and out becomes so painfully slow that data exploration becomes virtually impossible.
However, when I save the QueryLayer as a geojson file to my local drive, rendering becomes lightning fast and the issue is fixed. Is it expected behavior that data originating from external database connections render slowly? If read/write operations are not being performed, why is rendering so slow on datasets that have been fully uploaded (in other words, when the read operation has finished)? Is there a setting in QGIS that would bring the layer into local memory and alleviate the need for saving layers as local files?