[Qgis-user] QGis checks uniqueness of primary key on startup
Sergio Gollino
gollinosergio at gmail.com
Tue May 20 04:46:51 PDT 2014
Ok 20 milion of records is the problem not the unique key...
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.
Use a field of the table to filter it before you load on qgis.
And load it when you are a scale like 10.000 or less.
If this is not enough you have to make tiles of you your table.
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.
2014-05-20 12:44 GMT+02:00 Florian Lohoff <f at zz.de>:
> On Tue, May 20, 2014 at 12:27:31PM +0200, Sergio Gollino wrote:
> > Hi Florian,
> > if you just need a primary key on your view you can add this on your
> view:
> >
> > CREATE OR REPLACE VIEW v_kvztallength_pos AS
> > SELECT
> > row_number() OVER (ORDER BY tablename.id) AS gid,
> > ecc...
> > ecc.. .
> > FROM tablename
>
> I'll try that - my first guess is thats it not faster ;)
>
> > This create a column with a unique value (gid) that Qgis will recognize.
>
> > you can choose the unique key in the table tree when you add your view in
> > qgis. see -->http://i.stack.imgur.com/Da0xP.png
> >
> > but I'm not sure that your problem is here, how many rows have your view?
>
> About 20 Million IIRC - And i have told qgis what the unique key is.
> My datasource has:
>
> [...] key='id' srid=4326 type=POINT table="public"."v_kvztallength_pos"
> (position) sql=
>
> > If I have understand it right, you want to edit your view, but you can't
> > (in an easy way) edit a view even if you have a primary key. Its better
> for
> > you to create a table and use spatial indices.
>
> I dont need to edit the view i just want to display it.
>
> Its basically a join over an address (with geocoded position) with metadata
> in a different table. The metadata references the address with a foreign
> key.
>
> Flo
> --
> Florian Lohoff f at zz.de
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.10 (GNU/Linux)
>
> iQIVAwUBU3syGZDdQSDLCfIvAQiy0hAAkAV1q1SVRHwFv/N9LpPcS/GzB+1Fgo2p
> +lkoyQkjk2zUHzmrVFhZaAZTvMd8VWGjRXHv9+qwaUX6EAzrNDE0jkZ73YZc+wTl
> zCAQjmlUICZM1MjfcMTC04jFHALzgHZ0DBeXNi4qW4idqBRmiyIrRam/OFBs3eqe
> KQHYzomdERXTUct72OnoBIQ/JN9r6xtSn29yjJO8QkiYF1Uph2LV5YHVsZOQJtTt
> QO3DIoce+tyaSKbwKHk3p4DxEIP2V+puSuQzTW8eMJG/y8Nmr1P4JeBQ1TZ/dpUt
> RzSEN5uxUAmy4GRukCMgnHqxEXEsiVElvUzSrpiRDAW4HA4f+nU6ZVPnpERvDo/0
> 9CajTEsYVAEl7iws6/hajgDd0KcFS8TXRZ8WmrG+yjrPS2BgwkXBoo+gEVvRQyPz
> KZZzawD2YDjkPrV64WumGp1DizqHPPHNI76si8N61qFhVSp0QQUCYSGfVSXL2CbJ
> x/g63ya8GRNFvHX8QXOqpMyXuEBvWZY/U3AvwzbmoxyWCKR9lxGv7gqacz4U5BFL
> ypxqVwQ/qRSJvp7GTu9uD9luqpwTTfNynUk56LEfxIWhwwg0mklveDZ4MdII04Jp
> KXSzpn7lWudTRmz2QqSFjZZiNh5T1TeAd3ejDOeBmblsYNhzLHWLcxeZvqPDNyhS
> 3CcMhu4zniw=
> =TMEp
> -----END PGP SIGNATURE-----
>
>
--
Sergio Gollino
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20140520/0c2ed3be/attachment.html>
More information about the Qgis-user
mailing list