<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Copy mode is not enabled by default for append, because of the
      potential risks of some columns being computed ones (among other
      thingsà, whereas when GDAL creates a table, it knows that such
      thing cannot happen.</p>
    <p>If you do basic use, you can definitely explicitly enable copy
      mode for append operations by adding --config PG_USE_COPY YES<br>
    </p>
    <div class="moz-cite-prefix">Le 27/05/2022 à 16:58, Alexandre Gacon
      a écrit :<br>
    </div>
    <blockquote type="cite"
cite="mid:CAFJaAp7NhXhdGqVBfoogG9Rq1s=7BnctGzpMfpjNo-qBJAa=Gw@mail.gmail.com">
      <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"
            moz-do-not-send="true" class="moz-txt-link-freetext">jukka.rahkonen@maanmittauslaitos.fi</a>>
          a écrit :<br>
        </div>
        <blockquote class="gmail_quote">
          <div lang="FI">
            <div class="gmail-m_2371060661028486274WordSection1">
              <p class="MsoNormal"><span>Hi,</span></p>
              <p class="MsoNormal"><span> </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.</span></p>
              <p class="MsoNormal"><span lang="EN-US"> </span></p>
              <p class="MsoNormal"><span lang="EN-US">-Jukka Rahkonen-</span><span
                  lang="EN-US"></span></p>
              <p class="MsoNormal"><span lang="EN-US"> </span></p>
              <div>
                <p class="MsoNormal"><b>Lähettäjä:</b> gdal-dev <<a
                    href="mailto:gdal-dev-bounces@lists.osgeo.org"
                    target="_blank" moz-do-not-send="true"
                    class="moz-txt-link-freetext">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"
                    moz-do-not-send="true" class="moz-txt-link-freetext">jan.heckman@gmail.com</a>><br>
                  <b>Kopio:</b> gdal-dev <<a
                    href="mailto:gdal-dev@lists.osgeo.org"
                    target="_blank" moz-do-not-send="true"
                    class="moz-txt-link-freetext">gdal-dev@lists.osgeo.org</a>><br>
                  <b>Aihe:</b> Re: [gdal-dev] ogr2ogr Postgres upload
                  performance</p>
              </div>
              <p class="MsoNormal"> </p>
              <div>
                <p class="MsoNormal">I will try this way. To turn of SI
                  creation : <strong><span>SPATIAL_INDEX</span></strong>=NONE
                </p>
              </div>
              <p class="MsoNormal"> </p>
              <div>
                <div>
                  <p class="MsoNormal">Le lun. 23 mai 2022 à 15:15, Jan
                    Heckman <<a href="mailto:jan.heckman@gmail.com"
                      target="_blank" moz-do-not-send="true"
                      class="moz-txt-link-freetext">jan.heckman@gmail.com</a>>
                    a écrit :</p>
                </div>
                <blockquote>
                  <div>
                    <p class="MsoNormal">Perhaps the spatial index
                      update (in de DB) slows the insertion.</p>
                    <div>
                      <p class="MsoNormal">It might be more efficient to
                        not create the SI in the first run,</p>
                      <div>
                        <p class="MsoNormal">then insert more rows and
                          create the SI after all is done.</p>
                      </div>
                      <div>
                        <p class="MsoNormal">I don't know how to turn
                          off SI creation in the command line.</p>
                      </div>
                    </div>
                  </div>
                  <p class="MsoNormal"> </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" moz-do-not-send="true"
                          class="moz-txt-link-freetext">alexandre.gacon@gmail.com</a>>
                        wrote:</p>
                    </div>
                    <blockquote>
                      <div>
                        <div>
                          <p class="MsoNormal">Hello,</p>
                        </div>
                        <div>
                          <p class="MsoNormal"> </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).</p>
                        </div>
                        <div>
                          <p class="MsoNormal"> </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).</p>
                        </div>
                        <div>
                          <p class="MsoNormal"> </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 ?</p>
                        </div>
                        <div>
                          <p class="MsoNormal"> </p>
                        </div>
                        <div>
                          <p class="MsoNormal">Should I concatenate all
                            the geopackages first and then insert the
                            data in Postgis?</p>
                        </div>
                        <div>
                          <p class="MsoNormal"> </p>
                        </div>
                        <div>
                          <p class="MsoNormal">Thank you for your help</p>
                        </div>
                        <div>
                          <p class="MsoNormal"><br>
                            -- </p>
                          <div>
                            <p class="MsoNormal">Alexandre Gacon</p>
                          </div>
                        </div>
                      </div>
                      <p class="MsoNormal">_______________________________________________<br>
                        gdal-dev mailing list<br>
                        <a href="mailto:gdal-dev@lists.osgeo.org"
                          target="_blank" moz-do-not-send="true"
                          class="moz-txt-link-freetext">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" moz-do-not-send="true">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a></p>
                    </blockquote>
                  </div>
                </blockquote>
              </div>
              <p class="MsoNormal"><br>
                <br>
                -- </p>
              <div>
                <p class="MsoNormal">Alexandre Gacon</p>
              </div>
            </div>
          </div>
        </blockquote>
      </div>
      <br>
      <br>
      -- <br>
      <div dir="ltr" class="gmail_signature">Alexandre Gacon</div>
      <br>
      <fieldset class="moz-mime-attachment-header"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
gdal-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/gdal-dev">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a>
</pre>
    </blockquote>
    <pre class="moz-signature" cols="72">-- 
<a class="moz-txt-link-freetext" href="http://www.spatialys.com">http://www.spatialys.com</a>
My software is free, but my time generally not.</pre>
  </body>
</html>