Mason_S
Senior member
Joined: 1 Apr 2008 09:03:08
Messages: 380
Offline
|
Hi David,
I am sorry, but GridSQL and PostgreSQL do not have this capability.
You would have to do something where you first check for its existence, then either INSERT or UPDATE. Or, try and INSERT, and if it fails, perform an UPDATE.
Actually, I recommend avoiding INSERT anyway- it is much faster to populate data using COPY or gs-loader.
I have an idea- gs-loader.sh typically loads large amounts of data at a time, for efficiency. You can tell it to keep retrying in smaller and smaller chunks if something fails. It also will save rejected lines in a separate file. So, you could try and load a big delimited file, while specifying a relatively small chunk/commit size, and then once finished, have a script go through all of the lines and generate UPDATE statements in a sql file and run it via psql. You could even batch these up for better performance.
Thinking about this a bit more, that would be a nice little utility if we extended gs-loader to optionally do something like that based on the target table's meta data information, but we are busy at the moment. Perhaps someone in your organization would be willing to take that on...
Regards,
Mason
|