<div dir="ltr"><div><div><div>Ok 20 milion of records is the problem not the unique key...<br><br></div>Create a table (not a view) and use indices and geometry constraints. Check the "Use estimated table metadata" option in the connection as Jurgen said.<br>

</div>Use a field of the table to filter it before you load on qgis. <br>And load it when you are a scale like 10.000 or less.<br></div><div>If this is not enough you have to make tiles of you your table.<br></div><div><br>

</div>Remember that if you have a shp file whit 20 milion of geometries probably you will wait for all your life to display it, so, 5 or 10 minutes, its a really good result.<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">

2014-05-20 12:44 GMT+02:00 Florian Lohoff <span dir="ltr"><<a href="mailto:f@zz.de" target="_blank">f@zz.de</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div class="">On Tue, May 20, 2014 at 12:27:31PM +0200, Sergio Gollino wrote:<br>
> Hi Florian,<br>
> if you just need a primary key on your view you can add this on your view:<br>
><br>
> CREATE OR REPLACE VIEW v_kvztallength_pos AS<br>
>  SELECT<br>
> row_number() OVER (ORDER BY <a href="http://tablename.id" target="_blank">tablename.id</a>) AS gid,<br>
> ecc...<br>
> ecc.. .<br>
> FROM tablename<br>
<br>
</div>I'll try that - my first guess is thats it not faster ;)<br>
<div class=""><br>
> This create a column with a unique value (gid) that Qgis will recognize.<br>
<br>
</div><div class="">> you can choose the unique key in the table tree when you add your view in<br>
> qgis. see --><a href="http://i.stack.imgur.com/Da0xP.png" target="_blank">http://i.stack.imgur.com/Da0xP.png</a><br>
><br>
> but I'm not sure that your problem is here, how many rows have your view?<br>
<br>
</div>About 20 Million IIRC - And i have told qgis what the unique key is.<br>
My datasource has:<br>
<br>
[...] key='id' srid=4326 type=POINT table="public"."v_kvztallength_pos" (position) sql=<br>
<div class=""><br>
> If I have understand it right, you want to edit your view, but you can't<br>
> (in an easy way) edit a view even if you have a primary key. Its better for<br>
> you to create a table and use spatial indices.<br>
<br>
</div>I dont need to edit the view i just want to display it.<br>
<br>
Its basically a join over an address (with geocoded position) with metadata<br>
in a different table. The metadata references the address with a foreign key.<br>
<br>
Flo<br>
<span class="HOEnZb"><font color="#888888">--<br>
Florian Lohoff                                                 <a href="mailto:f@zz.de">f@zz.de</a><br>
</font></span><br>-----BEGIN PGP SIGNATURE-----<br>
Version: GnuPG v1.4.10 (GNU/Linux)<br>
<br>
iQIVAwUBU3syGZDdQSDLCfIvAQiy0hAAkAV1q1SVRHwFv/N9LpPcS/GzB+1Fgo2p<br>
+lkoyQkjk2zUHzmrVFhZaAZTvMd8VWGjRXHv9+qwaUX6EAzrNDE0jkZ73YZc+wTl<br>
zCAQjmlUICZM1MjfcMTC04jFHALzgHZ0DBeXNi4qW4idqBRmiyIrRam/OFBs3eqe<br>
KQHYzomdERXTUct72OnoBIQ/JN9r6xtSn29yjJO8QkiYF1Uph2LV5YHVsZOQJtTt<br>
QO3DIoce+tyaSKbwKHk3p4DxEIP2V+puSuQzTW8eMJG/y8Nmr1P4JeBQ1TZ/dpUt<br>
RzSEN5uxUAmy4GRukCMgnHqxEXEsiVElvUzSrpiRDAW4HA4f+nU6ZVPnpERvDo/0<br>
9CajTEsYVAEl7iws6/hajgDd0KcFS8TXRZ8WmrG+yjrPS2BgwkXBoo+gEVvRQyPz<br>
KZZzawD2YDjkPrV64WumGp1DizqHPPHNI76si8N61qFhVSp0QQUCYSGfVSXL2CbJ<br>
x/g63ya8GRNFvHX8QXOqpMyXuEBvWZY/U3AvwzbmoxyWCKR9lxGv7gqacz4U5BFL<br>
ypxqVwQ/qRSJvp7GTu9uD9luqpwTTfNynUk56LEfxIWhwwg0mklveDZ4MdII04Jp<br>
KXSzpn7lWudTRmz2QqSFjZZiNh5T1TeAd3ejDOeBmblsYNhzLHWLcxeZvqPDNyhS<br>
3CcMhu4zniw=<br>
=TMEp<br>
-----END PGP SIGNATURE-----<br>
<br></blockquote></div><br><br clear="all"><br>-- <br>Sergio Gollino
</div>