3 ms·
> In my case with 100 000 000 records, the query is never finished. The DBMS just kills it. Why? Probably, because it led to the attempt to load the whole table
by tbrock 9y ago
> In my case with 100 000 000 records, the query is never finished. The DBMS just kills it. Why? Probably, because it led to the attempt to load the whole table into RAM.
What? Why? It should just instantiate a cursor and return the first batch size worth of records.
I’m not sure why the dB pulls load the entire result set into ram to return results unless it requires a sort on a non indexed field.
- nieksand 9y agoMysql would fall back to a disk based sort once the data set is too large. Perhaps it's his client that is OOM-ing? Back in the day, I remember the PHP mysql client loading the entire result set into a local buffer unless you explicitly asked for the output to be streamed. Edit: Found reference to PHP behavior I mentioned: http://php.net/manual/en/mysqlinfo.concepts.buffering.php http://php.net/manual/en/mysqlinfo.concepts.buffering.php
- deleted 9y ago[deleted]