For web map tiles (millions of tiny PNGs), everyone who's anyone stores their tiles in sqlite rather than on disk: https://www.mapbox.com/help/an-open-platform/#mbtiles
FYI, in sqlite is still on disk.
SQLite small blob storage: 35% Faster Than the Filesystem
151–160 of 208 posts
Re: SQLite small blob storage: 35% Faster Than the Filesystem
#152I know that SQLite performs exceptionally on embedded devices including most phones, IoT devices, and more. However, for better or worse, it's a flat file. Does anyone know of a TCP/IP-speaking SQL database that would work well on an embedded device? PostgreSQL/MariaDB seem kinda heavy, and the net couplers for SQLite look pretty unsupported.
Re: SQLite small blob storage: 35% Faster Than the Filesystem
#153For web map tiles (millions of tiny PNGs), everyone who's anyone stores their tiles in sqlite rather than on disk: https://www.mapbox.com/help/an-open-platform/#mbtiles
Part of the concerns outlined in that article and of more importance for this company are ease of distribution/compatibility for customers of mapsets and mobile devices, rather than raw read/write performance, however.
Though the storage size claims might be relevant, and definitely a clear example that sqlite can be very workable and performant in the context of blob storage.
Re: SQLite small blob storage: 35% Faster Than the Filesystem
#154SQLite is good when you’re mostly reading. For writing, the major drawback of SQLite is it doesn’t support concurrent writes. All filesystems do (at least when writing different files), all full-fledged RDBMS-es do, even some embedded databases do (like ESENT). Yet, in SQLite only a single thread can write. Even embedded chips are multicore these days…
I'd be happy to be wrong (seriously that would make my day if someone could explain a clean way to do the above) but if I want to get "big boy database features" then I'd use a heavy database like SQL Server. I think it's great that there's an option like SQLLite out there for rapid prototyping and "store all your music metadata" type applications!
Re: SQLite small blob storage: 35% Faster Than the Filesystem
#155Earlier quoted context omitted.
which involves dropping a single header in your project and about 10 lines of code. 10 lines of user code + the sqlite library. Using other formats like zip is hardly any more user code (+ some external library).
The sqlite 'library' is a single header file and a single c file that you can just drop in your project and use.
Btw I'm personally a big fan of SQLite, I just think the argument here is a bit of a straw man.
Re: SQLite small blob storage: 35% Faster Than the Filesystem
#156Earlier quoted context omitted.
My experience (for an application which had a working set of under 1 GB of files in the 50kb to N MB range, and approximately 50 GB persisted at any given time) was that preserving access to the toolchain which operates trivially with files was worth the additional performance overhead of working with the files and, separately, occasionally having to retool things to e.g. not have 10e7 files in a single folder, which…
¿Porque no los dos? Store the files in a database but expose them via FUSE.
Re: SQLite small blob storage: 35% Faster Than the Filesystem
#157Earlier quoted context omitted.
Ah, but the filesystem has to do all that as well! It must receive a path, parse it, and then execute the query, with possible optimizations (eg. ext4 even has indexes implemented with hashed b-trees). A filesystem is just an hierarchical database.
>A filesystem is just an hierarchical database. Loosely. Today's file systems aren't transactional (i.e. acid compliance), which is a basic property that most people consider necessary for a database.
Re: SQLite small blob storage: 35% Faster Than the Filesystem
#158Earlier quoted context omitted.
¿Porque no los dos? Store the files in a database but expose them via FUSE.
That gives you the time cost of a filesystem plus the time cost of a database plus an extra round-trip in and out of kernel space.
Sounds like they're OK with that.
In any case, couldn't you avoid the kernel trips with some dylib foolery (assuming the toolchain is dynamically linked)?
Re: SQLite small blob storage: 35% Faster Than the Filesystem
#159Earlier quoted context omitted.
>A filesystem is just an hierarchical database. Loosely. Today's file systems aren't transactional (i.e. acid compliance), which is a basic property that most people consider necessary for a database.
That's not really a true statement. I use plenty of databases that aren't transactional beyond a single record.
> a basic property that most people consider necessary
I use non-ACID stores for some purposes, but don't consider them real databases.
Re: SQLite small blob storage: 35% Faster Than the Filesystem
#160Earlier quoted context omitted.
> Do a query, get back a handle to a file that you can treat just like you opened it yourself Things are a bit more complex. For one, the trivial problem of client vs. server host. The DB cannot return a handle (a FD) from the server, because it has no meaning on the host running the app. The second problem is that any file manipulation must conform to the DB semantics for transactions, locking, rollback and recovery…
I figured there was something massively annoying with it. I'm hoping that PostgreSQL can try to tackle this use-case somehow because it's so damn common and 99% of the time the solution that is used completely throws out all the guarantees that the database gives you.
In some ways, the problem mirrors OR mappers. A lot of common cases can be handled, but there are always situations where you're confronted with the fact that relational logic just doesn't map cleanly to OO (or hierarchic storage).