There is a PDL module PDL::IO::DBI to make this straightforward. To make it scale Really Big, you'd probably need to read the data into something like CSV, then transform it into packed data, then memory-map that (on disk) using PDL::IO::FastRaw. Pull requests to make that more automatic would be most welcome!