I have a table on a postgres remote database via internet, which has some 700k records in it.
I want to read the rowids of it, so I use
select table.pk as rowid from table order by rowid
this takes some time, around 20 seconds due to the amount of datas that gets returned 3-5MB
I wonder if postgres returns these values as binary integers, or as a text string with the datas between commas ?
it would take less time to get them binary, but can we force it to return binary instead of text datas ?
how is it for other databases mysql or oracle ?
you get back a recordset, not an array, not a string…
it returns it in a format that works to fill a recordset… what that format is, is not important and cannot be controlled (other that typecasting in you Select statment which will just increase the time)
And no matter what, 700K will take time… the database has to execute the SQL, assemble the data, transmit the data, then you app has to intake that data and offer up a recordset…
So you have no control on HOW it is delivered, just WHAT (ie. content) is delivered
FYI… 700K records in a 5mb result set is 7bytes per record… which is smaller than a 64bit integer… so I doubt anything would make the result much smaller