I know QGIS/GDAL can create a spatial index for data in a geopackage. But what about non spatial data, how do I create an index for a non spatial data column using QGIS/GDAL for a geopackage data set?


2 Answers 2


With ogrinfo https://gdal.org/programs/ogrinfo.html

ogrinfo -sql "CREATE INDEX index_name ON table_name (column1, column2,columnN...)" my_geopackage.gpkg

To stay within QGIS you can use DB Manager. Just connect the GeoPackage to your DB-Manager via right click on "GeoPackage" -> "New Connection..." and then open the SQL Window. Use a query such as:

CREATE INDEX myindex ON testgeopackage (mycolumn1, mycolumn2)

enter image description here

  • 1
    While using the DB Manager I also noticed the "Table"->"Edit Table" table properties window has an Index pane with the option to create the index. Commented Jul 1, 2022 at 6:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.