I have a huge MySQL table with millions of records. I have a use case where, based on date column, I want to split and dump the results in different text file.
For example:
col_1 col_2 date_col
a b 20-12-2021
a b 20-12-2021
a2 b2 21-12-2021
.. .. ...
So row1
and row2
will go to a CSV called 20_12_2021.csv
and row3
will go to 21_12_2021.csv
. What I am doing right now is I am using Python to fetch results and then loop over row by row and then determine where the result will go, but it is taking a huge time.
Is there any better more optimized way to do this?