AltSql Ask Puts One SQL Question to 500 Machines and Brings Back Only the Answers
An engineer wants to know which machines ran hot last night. The usual way is to pull every machine’s readings to a server first and ask there. That moves every raw reading, and on a slow or costly link the moving is the expensive part.
AltSql Ask turns that around. The gateway takes an ordinary SQL question and compiles it into a small program. It sends that program to every device. Each device runs it against its own records and sends back its share of the answer, and the gateway merges the shares into the rows the same SQL would have given over all the raw data.
A question must never hurt the device it runs on. So every program carries limits: how many steps it may take and how many groups its answer may hold. Each device checks the program before it runs a single step. A program that has been damaged on the way is refused. One that runs into its limits stops, and says so.
What the Alpha Found
For most of the demo’s questions, a device’s answer took 23 to 45 bytes. The demo’s fleet is 500 machines in five plants. Each keeps a day of readings, one every two minutes, and the fleet holds 10.9 MB in all. To check the merged answer, the demo pulls all 360,000 readings into one AltSql Core database and runs the same SQL there. The two answers should match, and in the demo they do.
Try It
Open the AltSql Ask demo, pick a question and ask the fleet. The page shows the program each machine receives, byte by byte, and what the question cost on the network against pulling every machine’s data. Then try to break it. Squeeze the budget, ask for too many groups, or flip three bits of the program on its way out.
Where It Stands
AltSql Ask is one C file of 1,923 lines, built on AltSql Core. It works and is tested in simulation on a PC, and it has not yet run on a microcontroller. The machines, their readings and the network in the demo are simulated. The compiler, the runner on every machine and the merge are the real engine, compiled to WebAssembly.
