Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Efficent way to read big files? #347

Closed
egorsmth opened this issue May 14, 2024 · 2 comments
Closed

Efficent way to read big files? #347

egorsmth opened this issue May 14, 2024 · 2 comments

Comments

@egorsmth
Copy link

I need to read files in a paginated way. I tried 2 options:

  1. parquetReader.iterator.slice(limit, limit + offset)
  2. RecordFilter(index => index >= offset && index < offset + limit)

First option pretty fast in the beginning of the file and slows down when we move to end of file. Totally It is rather slow in my case. Second option reads each "page" in a consistent time, but each read rather slow compared with reads of first option in the beginning of file.

What is the right way to read big files?

@mjakubowski84
Copy link
Owner

I am not sure what could be the reason of iterator + slice getting slower with time, especially that I do not know the rest of your code. Maybe you are loading the whole file into memory.

The second option can be quite slow in general, because you are opening a file each time.

In order to avoid memory issues and keep the high performance I recommend using a reactive solution that Parquet4S supports that is Akka, Pekko & FS2.

@egorsmth
Copy link
Author

Yeap, I guess I have some problem with whole file loading each time. I will try fs2 thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants