[QGIS-Developer] Postgis loading using COPY instead of INSERTS?

Nyall Dawson nyall.dawson at gmail.com
Wed Jun 14 21:00:13 PDT 2017


On 11 June 2017 at 08:04, Nyall Dawson <nyall.dawson at gmail.com> wrote:
> On 11 June 2017 at 05:49, Matthias Kuhn <matthias at opengis.ch> wrote:
>
>>
>> Something else to discuss is what will be sent along with the
>> `featureAdded(QgsFeatureId fid)` signal if the id is generated on the DB but
>> not propagated back to the client.
>>
>
> I don't think this is a big limitation - we just note it in the docs
> for the fast insert flag that featureAdded won't be emitted. It's only
> emitted when adding to a vector layer anyway, and most of the cases
> where the fast insert flag will be used will be adding directly to a
> data provider.

Right, I've implemented the flag over in https://github.com/qgis/QGIS/pull/4734

This opens the possibility of using a COPY statement in the postgres
provider when FastInsert flag is set. I haven't done that, so
presuming the PR is acceptable it'd be a good time for someone else to
jump in and make this improvement. All required changes would be self
contained in QgsPostgresProvider::addFeatures.

This would be great to have for 3.0 - we've already made huge
improvements in the speed of various related operations, and
implementing COPY for FastInsert would then also have massive flow on
benefits to processing algs which are saving their results direct to a
postgres database.

Nyall


More information about the QGIS-Developer mailing list