And in addition of Chris's answer:

The user you connect with, should have enough permissions to create or update 
an index.

If not, QGIS (or yourself via psql or another client) will also not be able to 
create the index/pk.
In that case you need to rise the permissions of your user, OR use another user 
to create it.

QGIS should NOT crash though.
If THAT is the case, please file a bug in our QGIS' tracker (with a 
reproducable scenario).

Regards,

Richard Duivenvoorde

PS which QGIS version are you using here? I cannot get this message visible 
(but I do not have large tables at hand currently)...


On 2/16/24 06:56, chris hermansen via QGIS-User wrote:
Rikesh and list,

On Thu, Feb 15, 2024, 18:40 Rikesh Lad via QGIS-User <qgis-user@lists.osgeo.org 
<mailto:qgis-user@lists.osgeo.org>> wrote:

    Hello,

    Please see attached. Does anyone know how to add a primary key and spatial 
index to a large layer without the software crashing?

    image.png



Here is some reference info about adding a primary key to a PostgreSQL table

https://www.postgresqltutorial.com/postgresql-tutorial/postgresql-primary-key/#:~:text=To%20add%20a%20primary%20key%20to%20an%20existing%20table%2C%20you,to%20the%20primary%20key%20constraint
 
<https://www.postgresqltutorial.com/postgresql-tutorial/postgresql-primary-key/#:~:text=To%20add%20a%20primary%20key%20to%20an%20existing%20table%2C%20you,to%20the%20primary%20key%20constraint>.



Here is some reference info that explains how to add a spatial index

https://postgis.net/workshops/postgis-intro/indexing.html 
<https://postgis.net/workshops/postgis-intro/indexing.html>


Both require the use of a PostgreSQL client for example "psql".



_______________________________________________
QGIS-User mailing list
QGIS-User@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user

_______________________________________________
QGIS-User mailing list
QGIS-User@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user

Reply via email to