logoalt Hacker News

TeMPOraLtoday at 8:05 AM2 repliesview on HN

> You never need to run any sort of complex SQL query on an image file format for instance.

Sure you will. Plenty of features that don't exist, or are implemented badly, because you can't easily do it.

Quick mental translation table: if you think "iterate over every ..." or a `for` loop, that's your SELECT query. If you think about `if` conditions, that's the parts that go after FROM clause.


Replies

x3rotoday at 8:12 AM

In order to have any advantage from this, you would have the added complexity of splitting your file format into tables that can be queried in a useful manner. However, for an image file format, you most likely need to hold the entire definition in memory at all times anyway. Assuming that’s the case, doesn’t XPath get you there most of the way (assuming XML), with _way_ less complexity?

show 1 reply
zelphirkalttoday at 8:42 AM

SQLite is fast, but it won't be faster than a hot loop in C. Having the loop construct dictated by the file format seems bad. For images it seems more reasonable to have them in-memory, except for huge image edge cases.

show 1 reply