• @[email protected]
    link
    fedilink
    162 years ago

    doesn’t sqlite explicitly encourage this? I recall claims about storing blobs in a sqlite db having better performance than trying to do your own file operations

    • @[email protected]
      link
      fedilink
      14
      edit-2
      2 years ago

      Thanks for the hint. I had to look that up. (The linked page is worth a read and has lots of details and caveats.)

      [https://www.sqlite.org/fasterthanfs.html]( SQLite reads and writes small blobs (for example, thumbnail images) 35% faster¹ than the same blobs can be read from or written to individual files on disk using fread() or fwrite().

      Furthermore, a single SQLite database holding 10-kilobyte blobs uses about 20% less disk space than storing the blobs in individual files.)

      Edit: I fucked up the link, but I am on mobile and my first attempt at fixing failed to fix. Fuck it

      Edit 2: as “when” matters:

      The measurements in this article were made during the week of 2017-06-05 using a version of SQLite in between 3.19.2 and 3.20.0. You may expect future versions of SQLite to perform even better.

      Edit 3:

      runs the database I/O measurements all within a single transaction. Use the --multitrans option to run each blob read or write in a separate transaction. The --multitrans option makes SQLite much slower,

      No shit. I am now having doubts.