Sorry, but I am out of ideas, I simply do not know enough about MSSQL to 
provide some insight. But I see, you are using a stored procedure instead of 
referring a table as source directly. Are you sure that this is not the 
culprit? It might work fine inside MSSQL but might pose problems when facing 
with the outside.

Just to rule out the file format, did you try writing to Shapefile or some 
other format to test wether it is a problem with the GeoPackage format itself 
or maybe the ogr2ogr driver needs some tweaking?

What does querying with ogrinfo on your stored procedure give you as an answer? 
Maybe there is something in there for information as well ... missing spatial 
index on your side?

________________________________
Von: Dennis Burgess <dmburg...@linktechs.net>
Gesendet: Samstag, 10. Februar 2024 22:36
An: Frank Broniewski <broniew...@a-a.lu>; QGIS-User@lists.osgeo.org 
<QGIS-User@lists.osgeo.org>
Betreff: Re: [Qgis-user] Optimize QGIS Command_Line


Originally its in MSSQL, we have done a makevalid() on all lines before we use 
OGR2OGR to export it to a GeoPackage.  That file is on the local NVME drive.    
We did try setting the spatial index to no, this had very little difference in 
time.


Dennis Burgess




________________________________
From: Frank Broniewski <broniew...@a-a.lu>
Sent: Wednesday, February 7, 2024 12:35:52 AM
To: QGIS-User@lists.osgeo.org; Dennis Burgess
Subject: AW: [Qgis-user] Optimize QGIS Command_Line

Hi Dennis,

concerning your first command, is your GeoPackage stored locally or on a 
network drive? Writing SQLite/GepPackage databases onto a network drive can 
have a severe performance impact. Another idea, did you try setting -lco 
SPATIAL_INDEX=no and creating the index after the import? This might speed up 
your import as well.

This page https://gdal.org/drivers/vector/sqlite.html  has some more insights 
on performance, but maybe you know it already ...

Concerning your second command, without knowing how many lines / polygons you 
want to dissolve here (seems like a lot looking at the file size) it looks 
pretty normal to me. Keep in mind that dissolving is a rather cost intensive 
process, when not dissolving by attribute. As every geometry has to be checked 
against all the others if they can be dissolved spatially - spatial indexes 
aside.
I do not know the internals of the algorithm itself, but I would guess it is 
not well suited for a threaded / multi process approach and it just runs on one 
core of your CPU doing all the work - like most GIS tools do.

A speedier approach could be to spatially divide your data into smaller parts, 
do the dissolve on each part to reduce the number of features, and then finally 
dissolve the results into the final one ...



________________________________
Von: QGIS-User <qgis-user-boun...@lists.osgeo.org> im Auftrag von Dennis 
Burgess via QGIS-User <qgis-user@lists.osgeo.org>
Gesendet: Dienstag, 6. Februar 2024 15:23
An: QGIS-User@lists.osgeo.org <QGIS-User@lists.osgeo.org>
Betreff: Re: [Qgis-user] Optimize QGIS Command_Line


ogr2ogr -f gpkg geom_multi_38.gpkg 
"MSSQL:server=xxxxxx;database=xxxxxxxxx;uid=xxxxxxxxx;pwd=xxxxxxxx;MultipleActiveResultSets=true;"
 -sql "EXEC xxxxxx 42039, 38" -overwrite  -gt 1000000 -lco SPATIAL_INDEX=yes  
OGR_SQLITE_CACHE=10240MB OGR_SQLITE_SYNCHRONOUS=OFF



This one takes around 30 min to export to gpkg file, if I run the same exec 
command on sql it takes less than 40 seconds to pull down ..  these are 
geometry lines.   Around 940 lines.



The second one





"c:\program files\qgis 3.26.2\apps\qgis\bin\qgis_process" run native:dissolve 
--INPUT=geom_multi_55096.gpkg --OUTPUT=geom_multi_diss_38.gpkg



This would e one of them.  Last job took 49 minutes, orginal input is around 
1.2 gig.



Dedicated platform for processing: 72 cores, 32 gig of RAM, running on NVME 
disk.

SQL 2019 Enterprise: 80 cores, 512gig ram, NVME disks.





From: Johannes Kröger (WhereGroup) <johannes.kroe...@wheregroup.com>
Sent: Tuesday, February 6, 2024 2:01 AM
To: Dennis Burgess <dmburg...@linktechs.net>; QGIS-User@lists.osgeo.org
Subject: Re: [Qgis-user] Optimize QGIS Command_Line



Hey Dennis,

can you share those command lines (maybe with sensitive information stripped)? 
Otherwise it is hard to guess what the issue might be.

What does your CPU, RAM and I/O utilisation look like during those long running 
processes? Same for the MSSQL database server host system.

Cheers, Hannes

On 05.02.24 14:46, Dennis Burgess via QGIS-User wrote:

I have two  command lines, one reads from my MSSQL database and creates a 
GeoPackage on the local disk.  This takes WAY too long, just to create it , it 
uses 5% or less CPU, and is SUPER slow. Looking for methods to speed this up.  
The data is around 1.2 to 1.4 gig of pop, but it should not take 50 min to 
create.



Also I am doing a dissolve on this data, once its on the disk, this also takes 
quite a while, even though when I do it from QGIS it takes like 10 min vs an 
hour or more on the computer with the command line.



I’m sure I am doing something wrong on both of these. Just trying to understand 
what it would be.



Thanks for any assistance !

Dennis





_______________________________________________

QGIS-User mailing list

QGIS-User@lists.osgeo.org<mailto:QGIS-User@lists.osgeo.org>

List info: https://lists.osgeo.org/mailman/listinfo/qgis-user

Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user

--

Johannes Kröger / GIS-Entwickler/-Berater



---------------------------------------------

Aufwind durch Wissen!

Web-Seminare und Online-Schulungen

bei der 
www.foss-academy.com<https://imsva91-ctp.trendmicro.com:443/wis/clicktime/v1/query?url=http%3a%2f%2fwww.foss%2dacademy.com&umid=7036B80A-10B7-5306-BAB5-505120F413E8&auth=079c058f437b7c6303d36c6513e5e8848d0c5ac4-0b980f826f3d937e36ac4d15a89c87a459c73be8>

---------------------------------------------



WhereGroup GmbH

c/o KK03 GmbH

Lange Reihe 29

20099 Hamburg

Germany



Tel: +49 (0)228 / 90 90 38 - 36

Fax: +49 (0)228 / 90 90 38 - 11



johannes.kroe...@wheregroup.com<mailto:johannes.kroe...@wheregroup.com>

www.wheregroup.com<http://www.wheregroup.com>

Geschäftsführer:

Olaf Knopp, Peter Stamm

Amtsgericht Bonn, HRB 9885

-------------------------------
_______________________________________________
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