I’m trying to find a way to efficiently compare a CSV file content with a MySQL database (Over 1 Million rows to compare), I’ve done something similiar before just placing all the rows into an array but that will work for a small number of rows because of memory overloading.
My question is, is there a recommendable way to doing that? Any libraries or something that could help?
I would appretiate your answers.
Assuming this is a sanity check and you’re aiming to have 0 differences, how about dumping out the database as a CSV file of the same format and then using command line tools (
difforcmp) to check that they match?You’d need to make sure your CSV dump is ordered & formatted the same as the original file of course.