hyperledger-labs / fabric-smart-client

The Fabric Smart Client is a new Fabric Client that lets you focus on the business processes and simplifies the development of Fabric-based distributed application.
Apache License 2.0
52 stars 52 forks source link

upsert instead of select and then update or insert #646

Open arner opened 3 months ago

arner commented 3 months ago

The SetState function of the sql version of KVS and Vault uses an ANSI compliant but not the most performant way to do an upsert; it tries a SELECT and based on the result, chooses to do an INSERT or an UPDATE.

Now that we have two distinct database drivers for postgres and sqlite, we should also use their respective ways to do an upsert in a single call.