<div dir="ltr">On Sat, Mar 4, 2017 at 8:26 AM, Tobias Wendorff <span dir="ltr"><<a href="mailto:tobias.wendorff@tu-dortmund.de" target="_blank">tobias.wendorff@tu-dortmund.de</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">Am Sa, 4.03.2017, 03:49 schrieb Nyall Dawson:<br>
>> I've loaded a PostgreSQL table with more than 3 * 10^6 entries.<br>
>> When accesing the attributes, QGIS downloads all the attributes!<br>
>> QGIS first gets instable and crashes afterwards.<br>
>><br>
>> Actually, it would be more useful to download only the attributes,<br>
>> which are in the current view.<br>
>><br>
</span>>> [...]<br>
<span class="">><br>
> Yep - it's really annoying for large layers. If you go to settings -><br>
> options -> data sources you can change "attribute table behaviour" to<br>
> "show features visible on map". That'll help a bit.<br>
<br>
</span>Thanks, I'll try it out soon.<br>
<span class=""><br>
> I've got changes incoming which also improve the performance if you<br>
> have the "show selected features" option enabled<br>
> (<a href="https://github.com/qgis/QGIS/pull/4164" rel="noreferrer" target="_blank">https://github.com/qgis/QGIS/<wbr>pull/4164</a>).<br>
<br>
</span>Another improvement would be to request the data in stages. Let's<br>
the attribute view shows 500 entries on each page. For shapefiles,<br>
sqlite and other database-like formats, it should work with OFFSET<br>
and LIMIT to minimize the amount of data being loaded:<br>
<br>
First page: SELECT * FROM xy OFFSET 0 LIMIT 500<br>
Second page: SELECT * FROM xy OFFSET 500 LIMIT 500<br>
etc.<br>
<br>
That's what many tools for databank manipulation do.<br>
<br></blockquote><div><br><br></div><div>Yes, that would be a strategy, but you might run into problem with sorting and filtering if the data provider does not support for it.<br></div></div><br></div><div class="gmail_extra">I think that depending on provider's capabilities and number of records in the data source, different strategies should be implemented: for huge tables I suppose that a threaded loader or a paged loader are the way to go.<br><br></div><div class="gmail_extra">My 2 € cents<br clear="all"></div><div class="gmail_extra"><br>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">Alessandro Pasotti<br>w3:   <a href="http://www.itopen.it" target="_blank">www.itopen.it</a></div>
</div></div>