<div dir="ltr"><div>Hi Jukka,</div><div><br></div><div>The problem is not related to a multi-table geopackage but to a set of geopackages with several tables in each : the first geopackage creates the tables so it can use the PG_USE_COPY but for the other files it has to go with the INSERT. <br></div><div><br></div><div>Regards</div><div>Alexandre<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Le ven. 27 mai 2022 à 15:12, Rahkonen Jukka <<a href="mailto:jukka.rahkonen@maanmittauslaitos.fi">jukka.rahkonen@maanmittauslaitos.fi</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">





<div style="overflow-wrap: break-word;" lang="FI">
<div class="gmail-m_2371060661028486274WordSection1">
<p class="MsoNormal"><span>Hi,<u></u><u></u></span></p>
<p class="MsoNormal"><span><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">If the problem is that
</span><span lang="EN-US">PG_USE_COPY is applied only to the first layer of the multi-table GeoPackage then I would make a test by writing a separate ogr2ogr command for each layer.<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">-Jukka Rahkonen-</span><span lang="EN-US"><u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<div style="border-color:rgb(225,225,225) currentcolor currentcolor;border-style:solid none none;border-width:1pt medium medium;padding:3pt 0cm 0cm">
<p class="MsoNormal"><b>Lähettäjä:</b> gdal-dev <<a href="mailto:gdal-dev-bounces@lists.osgeo.org" target="_blank">gdal-dev-bounces@lists.osgeo.org</a>>
<b>Puolesta </b>Alexandre Gacon<br>
<b>Lähetetty:</b> maanantai 23. toukokuuta 2022 17.39<br>
<b>Vastaanottaja:</b> Jan Heckman <<a href="mailto:jan.heckman@gmail.com" target="_blank">jan.heckman@gmail.com</a>><br>
<b>Kopio:</b> gdal-dev <<a href="mailto:gdal-dev@lists.osgeo.org" target="_blank">gdal-dev@lists.osgeo.org</a>><br>
<b>Aihe:</b> Re: [gdal-dev] ogr2ogr Postgres upload performance<u></u><u></u></p>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<p class="MsoNormal">I will try this way. To turn of SI creation : <strong><span style="font-family:"Calibri",sans-serif">SPATIAL_INDEX</span></strong>=NONE
<u></u><u></u></p>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<div>
<p class="MsoNormal">Le lun. 23 mai 2022 à 15:15, Jan Heckman <<a href="mailto:jan.heckman@gmail.com" target="_blank">jan.heckman@gmail.com</a>> a écrit :<u></u><u></u></p>
</div>
<blockquote style="border-color:currentcolor currentcolor currentcolor rgb(204,204,204);border-style:none none none solid;border-width:medium medium medium 1pt;padding:0cm 0cm 0cm 6pt;margin-left:4.8pt;margin-right:0cm">
<div>
<p class="MsoNormal">Perhaps the spatial index update (in de DB) slows the insertion.<u></u><u></u></p>
<div>
<p class="MsoNormal">It might be more efficient to not create the SI in the first run,<u></u><u></u></p>
<div>
<p class="MsoNormal">then insert more rows and create the SI after all is done.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">I don't know how to turn off SI creation in the command line.<u></u><u></u></p>
</div>
</div>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<div>
<p class="MsoNormal">On Mon, May 23, 2022 at 3:04 PM Alexandre Gacon <<a href="mailto:alexandre.gacon@gmail.com" target="_blank">alexandre.gacon@gmail.com</a>> wrote:<u></u><u></u></p>
</div>
<blockquote style="border-color:currentcolor currentcolor currentcolor rgb(204,204,204);border-style:none none none solid;border-width:medium medium medium 1pt;padding:0cm 0cm 0cm 6pt;margin-left:4.8pt;margin-right:0cm">
<div>
<div>
<p class="MsoNormal">Hello,<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">I am using ogr2ogr to upload data from several geopackages to a postgis database. Some tables contain thousands of rows (buildings for example).<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">The import of the first file is quite fast (tables are created for the first file so PG_USE_COPY is used) but the following file is much slower (using INSERT instead of COPY).<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">How could I data insertion for the other files? Force PG_USE_COPY ? Increase the value of GT ? Postpone spatial index creation ?<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">Should I concatenate all the geopackages first and then insert the data in Postgis?<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">Thank you for your help<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><br>
-- <u></u><u></u></p>
<div>
<p class="MsoNormal">Alexandre Gacon<u></u><u></u></p>
</div>
</div>
</div>
<p class="MsoNormal">_______________________________________________<br>
gdal-dev mailing list<br>
<a href="mailto:gdal-dev@lists.osgeo.org" target="_blank">gdal-dev@lists.osgeo.org</a><br>
<a href="https://eur06.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.osgeo.org%2Fmailman%2Flistinfo%2Fgdal-dev&data=05%7C01%7Cjukka.rahkonen%40maanmittauslaitos.fi%7C6fa46f068e26430b7f9908da3cca0f7a%7Cc4f8a63255804a1c92371d5a571b71fa%7C0%7C0%7C637889135792134784%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=%2Bmpy0HNtP0mb%2FzvSpD4E9U0Cipge3NviqQs%2B7D6hZcQ%3D&reserved=0" target="_blank">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a><u></u><u></u></p>
</blockquote>
</div>
</blockquote>
</div>
<p class="MsoNormal"><br clear="all">
<br>
-- <u></u><u></u></p>
<div>
<p class="MsoNormal">Alexandre Gacon<u></u><u></u></p>
</div>
</div>
</div>

</blockquote></div><br clear="all"><br>-- <br><div dir="ltr" class="gmail_signature">Alexandre Gacon</div>