Search Postgresql Archives

Use SPI_exec... to insert multiples rows in C

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I need to insert up to 12 rows (bulk). Basically, new row #1's ID is the table sequence nextval and parent = null; #2 is nextval + 1 and parent = row #1's ID, etc. A hierarchy.

I figured the most performant way to do this is to have the sequence increment by the max bulk insert quantity, 12. This way I can insert all rows in one statement, which I am sure is faster that 12 insert statements (I already tried that).

Ideally, I'd like to write this in C using SPI_exec(INSERT...)  (or one of its siblings). I figured it would be most efficient to write the rows to be inserted into a tuplestore and then insert them somehow. But I don't know how to do this and cannot find any examples.

Could someone point the way for me.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux