I am trying to stream binary data into a
The process is quite simple:
loop until the end of the incoming stream UPDATE myTable SET data = data || $chunk WHERE id = myId
$chunkis a binding for the current stream chunk
- The row (
myId) already exists with NULL data
- each chunk is about 64k
- the final data is around 4MB
Everything is working properly expect that concatenating data become more and more slow as chunks are stored.
Since I need to keep my SQL quite portable, I cannot use "PostgreSQL Large Objects"
Is it possible to optimize this process ?
- maybe by pre-allocating with with an empty data, and then use
overlay()to place each chunk ?