i’m pretty sure that every db engine can do this.
someone on a another dev tool forum pointed out that json is extremely inefficient/verbose.
think about it: for every column, for every row, you are including the name of the column. i back-of-the-enveloped that roughly 40% of the traffic will be overhead, between repeated column names and delimiter jigglies. it’s probably more like 50-55%, but it’s somewhere in the “way too much” zone.
i think the solution is to move the data via a tsv/csv format, instead.
one character delimiter between columns (unless you go traditional csv, where it would be three characters)
somewhere between one and four character delimiters between rows
do you really need to/want to include column names? you only have to include them in one row, one time, per query. if the data is paged, you don’t have to repeat that row.
In my use case the results are not from a DB query on the remote system
They’re returned from an API call
Like an iOS app that sends a query to a remote API that gets back a JSON data set
No direct connection to the DB
On the receiving end there’s no “nice” way to handle that data as if it was in fact a recordset/rowset in a Xojo baed app
But, with this, there is
Its maybe an hours worth of work and I’m sure I can/ could trim down the json to be much more efficient
It reminded me the “Remote Database Connector” of B4X:
Nonsense. csv is just a plain text prone to a LOT of errors. Also MOST API ussage is to return single rows so you end with the same amount of data, a set of header and a row but in a crapier format.
Returning larger datasets, HTTP2 and compression make the overhead almost negligible.
And finaly, for datasets really big or when high efficiency and speed is needed you simply dont use a text based protocol. Binary JSON or Protobuf are an option for this.
does json have error correction? i must have missed it.
i don’t know why you would ever return column titles, unless the API is a mystery, or returns random columns. otherwise, you wrote the API, so you don’t need the column titles, unless it makes you feel better to ship them, with the data.
i’m not sure why you would do single-row queries. why aren’t you caching the data on the local device, and then just syncing, as necessary?
that has not been my experience. compression definitely speeds things up, but json is still much flabbier. i’m reworking an API, now, so this will be a fun little test to perform on 100k rows.
there are all kinds of tricks you can use, chunking/paging, async + sockets, etc., but json is still too bulky, compared to just sending the data, but, as i said, i’m currently reworking an API, now, so it will be fun to test combinations of other ideas, and see if this data set proves them to be reasonable alternatives.
Because with a grid like Tabulator or w2grid element names are used to map data to the relevant column in the grid. For example in Tabulator you’d initialise your columns:
i’m assuming this is a xojo-thing. i’m a xojo n00b. the other dev tools we write apps with don’t need the columns specified in the data. they can use them, but they don’t need them.
plus, if you’re mobe-first (we are, more often than not), you’re populating from the local data, not the server.