I'm just trying to figure out the most efficient way to query lots of data. My problem is that I want to process multiple rows of data at once, as they come in, not one-by-one. However, the standard sql.Rows interface only allows you the access to a single row at a time in my understanding, leaving the buffering to the lower-level database provider implementation. Are there some lower level API's that would allow access to these without having to rebuffer the data manually by some arbitrary amount?
My problem is copying data from a database of one dbms (sql server) to another database of another dbms (postgres), and the other way around, but I want my code to be generic enough to handle copying that data to multiple other providers at the same time. I've got connections and transactions sorted, now the plan was to read batches of data from the first database, while sending the available read data to all of the other providers, skipping the current batch when it's been copied to all of the other databases.
There are subtleties with data conversion from the representation of one provider to another. Would the best way to solve this (least allocations possible) be to use an intermediate type? So like sql server -> string field (or whatever) -> postgres. Also, can I make this method reuse the same buffers for strings? Or is there a way to directly convert RawBytes of one dbms to RawBytes of another dbms without reimplementing the conversion logic? I mean some higher level helper interface or something of sorts. I imagine not, but still, it's worth asking.
To be clear, this is not an actual task on the job. I'm just trying to figure out the most efficient way to implement this for learning purposes. So far, the available abstractions just seem too high level.