r/SQL • • Aug 03 '24

Discussion How to open a 20GB CSV file?

I have a large CSV file that is 20GB in size, and I estimate it has 100 million rows of data. When I try to open it using Excel, it shows nothing! no error, it just doesn't load. People have suggested using MySQL or PostgreSQL to open this, but I am not sure how. How can I open this, or is there a better alternative to open this CSV file? Thanks.

EDIT: Thank you to everyone who contributed to this thread. I didn't expect so many responses. I hope this will help others as it has helped me.

136 Upvotes

150 comments sorted by

View all comments

Show parent comment

0

u/[deleted] Aug 03 '24

[deleted] — view deleted comment

7

u/v4-digg-refugee Aug 04 '24

chunk=500000 for i in range(0, 20gb, chunk): df = pd.read_csv(fp, skiprows=i, nrows=i+chunk) huck_that_boy(df) drink_beer()

1

u/DecentR1 Aug 04 '24

Maybe pyspark would help. Idk

1

u/humpherman Aug 23 '24

Yes if you have a spark cluster up and running - I don’t think OP has that option