Adding auto increment field to couchdb postgresql table

Hi @bamatic !

Could we add an auto incremental colonne to this table safely without crashing the coucdb2pg doc insertions in this table ?

I think that would work fine, although this hasn’t been tested at all. It would be easy enough to test it out on your data on a clone and see if it works as expected. It’s possible you’ll get duplicated data (ie: multiple versions of the same doc, or even multiple auto-generated IDs for the same version of the same doc) so be sure to filter these out in your ETL layer using the _id and _rev fields.

Also note that making schema changes like that may make upgrading couch2pg in future difficult as it won’t match the expected schema, however couch2pg is currently in maintenance mode and no further releases are planned.

Could we please get your advise on this ?

At Medic we’ve also hit the same limitation with incremental updates. To get around this we’re in the process of developing an ETL pipeline to completely replace couch2pg and use incremental updates to improve update performance with large datasets. While this is pre-beta at this stage you can read more about the design and there will be discussion and maybe even a demo of this new pipeline in the upcoming CHT Round-up call.

Are you interested in being an early adopter for this pipeline? If so we’d be very interested in working with you to get this ready for production use.

1 Like