sql how to read 2GB LONGTEXT with low memory footprint

Viewed 25

in php to get last line and line count from big file with low memory footprint, we can do like this:

$file = new SplFileObject('/path/to/file.txt');
$lastLine = $file->seek($file->getSize());   //get last line data
$linesCount = $file->key();   //count how many lines

For some reason I can only store this text data in sql. Is there any way to read only our preferred line and get the total count without loading complete data to memory first? my 2GB LONGTEXT have millions line of text.

0 Answers
Related