Thanks. Would you recommend QGIS do that instead of the expensive query on the view?<div><br></div><div>BTW, turns out there was a QGIS option to limit the expensive query to 100 rows, but it was kind of buried.<br><div><br>

<div class="gmail_quote">On Sun, Jan 30, 2011 at 11:40 PM, Bruno Friedmann <span dir="ltr"><<a href="mailto:bruno@ioda-net.ch">bruno@ioda-net.ch</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

<div class="im">On 01/30/2011 09:43 PM, Aren Cambre wrote:<br>
> Discussing with a developer, it turns out there's an option named *Use<br>
> estimated table metadata* in the PostGIS connection properties. Using that<br>
> solved it for me as it adds *LIMIT 100* to the query.<br>
><br>
> So the fix is there, it's just kind of buried.<br>
><br>
> And, again, this is for a view, and it appears there's no way to know what a<br>
> kind of geometry is in a view's geometry column without inspecting it.<br>
><br>
> Aren<br>
<br>
</div>Aren, on recent postgis, >1.5x if you issue the select populate_geometry_columns() it take care of views too.<br>
<div><div></div><div class="h5"><br>
><br>
> On Sun, Jan 30, 2011 at 2:03 PM, Ivan Mincik <<a href="mailto:ivan.mincik@gmail.com">ivan.mincik@gmail.com</a>> wrote:<br>
><br>
>> On Sun, Jan 30, 2011 at 4:59 PM, Aren Cambre <<a href="mailto:aren@arencambre.com">aren@arencambre.com</a>> wrote:<br>
>>> I noticed this really inefficient query when QGIS was importing a Postgis<br>
>>> layer:<br>
>>> select distinct case when geometrytype("the_geom") IN<br>
>> ('POINT','MULTIPOINT')<br>
>>> THEN 'POINT' when geometrytype("the_geom") IN<br>
>>> ('LINESTRING','MULTILINESTRING') THEN 'LINESTRING' when<br>
>>> geometrytype("the_geom") IN ('POLYGON','MULTIPOLYGON') THEN 'POLYGON' end<br>
>>> from [databaseGoesHere]<br>
>>> That surprised me because QGIS should already know the geometrytype<br>
>> through<br>
>>> the geomerty_columns table.<br>
>>> Is this really QGIS's fault, or did Postgis cause/require this? Want to<br>
>> make<br>
>>> sure before I file a bug report.<br>
>><br>
>> Hi, which QGIS version do You use ?<br>
>> Has all You tables and views valid records in 'geometry_columns' ? If<br>
>> not, tables/views which are not present in 'geometry_colums' are<br>
>> queried by query You are talking about. If just one of them is big, or<br>
>> time expensive view, each database connect will take very long time.<br>
>><br>
>> In current trunk (and I do not remember how many versions back), there<br>
>> is option 'Only look in the geometry_columns tables' which can help<br>
>> You.<br>
>><br>
>> Ivan<br>
>> _______________________________________________<br>
>> postgis-users mailing list<br>
>> <a href="mailto:postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net</a><br>
>> <a href="http://postgis.refractions.net/mailman/listinfo/postgis-users" target="_blank">http://postgis.refractions.net/mailman/listinfo/postgis-users</a><br>
>><br>
><br>
><br>
><br>
> _______________________________________________<br>
> postgis-users mailing list<br>
> <a href="mailto:postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net</a><br>
> <a href="http://postgis.refractions.net/mailman/listinfo/postgis-users" target="_blank">http://postgis.refractions.net/mailman/listinfo/postgis-users</a><br>
<br>
<br>
</div></div><font color="#888888">--<br>
<br>
Bruno Friedmann<br>
Ioda-Net Sàrl <a href="http://www.ioda-net.ch" target="_blank">www.ioda-net.ch</a><br>
<br>
openSUSE Member & Ambassador<br>
GPG KEY : D5C9B751C4653227<br>
irc: tigerfoot<br>
</font><div><div></div><div class="h5">_______________________________________________<br>
postgis-users mailing list<br>
<a href="mailto:postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net</a><br>
<a href="http://postgis.refractions.net/mailman/listinfo/postgis-users" target="_blank">http://postgis.refractions.net/mailman/listinfo/postgis-users</a><br>
</div></div></blockquote></div><br></div></div>