Suggestion: create callback parameter for the new getColumn()

BTW, if there’s any devs here: Does this function request the entire JSON from server or just a single column?

@i15904503668i getColumn() returns a single column from a table as a list. If you want all of the data as a JSON, you should use readRecords()

Hope this helps!

Did some testing - both readRecord and getColumn results in a similar response time and similar-sized data packet, so I assume getColumn downloaded the full JSON and decoded the column rather than requesting the server to only fetch the said column. Therefore getColumn is not suitable for data consumption optimization and is generally inferior than readRecords, since there’s no function callback and all arguments (whether within the function or not) after getColumn gets delayed.
Test Program

There is a bug in your program but I don’t think it affects the results since the code for the two tests isn’t as close to identical as possible and that can affect the timing.

I fixed those two problems then loaded the table with 44k of weather data. Ran the two tests and noticed that readRecord takes about 12 milliseconds and readCoumn takes 0 milliseconds. Therefore getColumn is very suitable for student sized projects and generally serves a different purpose than readRecords since it has no callback to confuse people. Having recently fielded questions about database callbacks from both students and teachers, making the next statement to run be the next statement is easy to use.

I would go so far as to say it would be nice to have getRecord(database, id). Then I could use getColumn to get the ids and then loop through those for each record in the database.

Once my program return 1ms for getColumn() too. That result, however, is likely bogus, as it took much longer to console.log() the entire data.

I suspect the millisecond counter gets delayed/frozen somehow after getColumn() was called, causing the timed loop to end precisely when getColumn() finishes && timer = 0/1, thus returning 0/1 ms.

I worked with Google Firebase (seems to be applab’s data backend)(also why data function is not working in Mainland China) before, and their service is not the fastest - for a large set of data, I don’t think the delay could be as low as 0-1 ms, regardless of internet speed.

getRecord would be really handy - It would be even better if the server actually fetches a smaller JSON :wink:

You are correct. App Lab doesn’t do multitasking well. You can’t time it accurately anyway. We must remember that App Lab is a Javascript interpreter running on top of a Javascript interpreter. It was never intended to run fast and criticism for speed is unfair. I suspect the database is actually a text file on the server and the whole file is transferred.

But my point is it is probably good enough for student sized projects. You and I have talked about slow connections in China before Does update/read/createRecord return an error where there's a timeout?. Perhaps you could ask for an offline version that stores the database locally.