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

Store dependency table in different format #300

Closed
hagenw opened this issue Apr 28, 2023 · 3 comments
Closed

Store dependency table in different format #300

hagenw opened this issue Apr 28, 2023 · 3 comments

Comments

@hagenw
Copy link
Member

hagenw commented Apr 28, 2023

For tables we support CSV to provide them in a human readable format, but this is not necessary for the dependency table. In addition, the dependency table is frequently accessed to gather basic information about a database.

I think it would make sense to switch to another format when storing it for new databases. It should be fast to read, and maybe support reading only parts like columns or rows of it to make sure it will always fit in memory.

@hagenw
Copy link
Member Author

hagenw commented Jan 22, 2024

As a side note, pyarrow will become a dependency of pandas anyway: https://github.com/pandas-dev/pandas/blob/main/web/pandas/pdeps/0010-required-pyarrow-dependency.md
So, it should be fine if we starting integrating pyarrow based approaches here as well, e.g., storing dependencies as parquet files.

@hagenw
Copy link
Member Author

hagenw commented Feb 14, 2024

We have now benchmark results for comparing using csv, pickle, parquet files to store the dependency table available at https://github.com/audeering/audb/tree/a8bb3367a37fae79601e189ccac76a1a12105bae/benchmarks#audbdependencies-loadingwriting-to-file.

We first focus on the results for reading as this will be performed more often than writing.

  • The fastest results can be achieved when using pyarrow dtypes for the internal dataframe representation of the dependency table, together with pyarrow.Table for reading from csv and parquet files
  • Reading speed is nearly identical from csv, pickle, and parquet files, and takes around 0.1 s for a dependency table with 1,000,000 entries
  • The parquet file needs only around 20% of space on disk (20 MB for 1,000,000 entries)

When looking at writing performance we get:

  • Writing speed is nearly identical for csv, pickle, parquet, and takes around 0.25 s for a dependency table with 1,000,000 entries

Having those results in mind it seems to be reasonable to switch storing the dependency table directly as parquet files, both on the server and in cache.

@hagenw
Copy link
Member Author

hagenw commented Jun 21, 2024

Solved by #372.

@hagenw hagenw closed this as completed Jun 21, 2024
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

1 participant