Linked by Thom Holwerda on Sat 11th May 2013 21:41 UTC
Windows "Windows is indeed slower than other operating systems in many scenarios, and the gap is worsening." That's one way to start an insider explanation of why Windows' performance isn't up to snuff. Written by someone who actually contributes code to the Windows NT kernel, the comment on Hacker News, later deleted but reposted with permission on Marc Bevand's blog, paints a very dreary picture of the state of Windows development. The root issue? Think of how Linux is developed, and you'll know the answer.
Permalink for comment 561610
To read all comments associated with this story, please click here.
RE[14]: Too funny
by satsujinka on Wed 15th May 2013 00:17 UTC in reply to "RE[13]: Too funny"
Member since:

Oh I see, you modified my quote in order to create a contradiction. (please don't do that again!)

No I modified your quote to show you were you were misinterpreting me. You were under the impression I wasn't talking about a text backed SQL query engine. So I modified your quote because apparently just saying it wasn't enough.

You *could* build an SQL database on top of any format you chose. I won't discourage you from trying it, but unless you create ODBC / JDBC / native data connectors for it, then you'd end up with a rather inaccessible SQL implementation. Still you *could* build all the SQL connectors and have a fully usable SQL database.

This is the same issue that journald faces. Of course, I think it's reasonable to infer that you feel that journald should use an existing database (say MariaDB or SQLite or ...)

I felt it was quite reasonable to assume that I was talking about what journald should have done (if it was going to go ahead and reinvent a database anyways.)

Now, conceptually your happy, but the implementation details are where problems begin cropping up. Almost any changes to records (changing data values or columns) mean re-sequencing the whole text file, which is not only inefficient by itself (particularly for large databases), but it means rebuilding all the indexes as well. Also many years of research have gone into the so-called ACID features you'll find in SQL databases. Consider atomic transactions, foreign key integrity, etc. SQL implementations are designed to keep the data consistent even in the event of a power loss, think about what that means for flat file storage.

All databases have to solve the same challenges. Nothing mentioned here is particularly different no matter your database backend. In short, implementing a database is hard.

Of minor note, no matter the format; changing a column value would not require re-sequencing the file. The rest of the file hasn't changed so the representation currently cached would still be valid; no need to restore it.

Another issue is that flat text file makes efficient concurrency difficult, any change that one program is making would have to block other readers/writers to avoid data corruption, I think you'll agree that the entire text file needs one large mutex in order to guaranty that the textual data is in a consistent state. Although linux has advisory file locking, I don't think standard tools like grep use it. After all your work to make your "custom SQL database" use a text format, you still cannot safely use standard tools like grep on it without first making sure the database is taken offline.

Again, no issues that other formats don't face. However, you are mistaken about something. You don't have to lock a file for reading; ever. grep/sed/awk will always work even if a database is currently using a file. The only time you need to lock files is when you're writing (and that only blocks writers.) So since you shouldn't ever be modifying your logs... neither the database or grep/sed/awk need to lock the files.

So I ask you now, what is the advantage of having a text SQL engine over being able to export text from a binary SQL database?

It's easier and more reliable to get to the data, with all that that implies.

The only criticism I can give merit to as a real fundamental problem is if you don't trust the database implementation to produce reliable results (for fun: I challenge you to find an instance of a popular database having produced unreliable query results on working hardware). For everything else you could export a text copy and even then I have to reiterate that it's my honest belief that for anyone who is proficient with SQL, hardly any would want to use the text tools by choice. SQL really is superior even for simple adhoc queries.

I've had issues where MS SQL Server doesn't delete rows from a table, but they also don't show up in queries... (they did appear in Management Studio though.)

Anyways, I disagree, SQL is not superior for simple queries. I would much rather use grep. We probably aren't going to agree here.

Even if I'm just browsing the data and not manipulating it, I'd rather have a tabular spreadsheet interface over a flat file one.

Libre Office Calc can open CSV files as a spread sheet...

I do appreciate how cleverly the text tools can be used in a unix shell, but the more I think about it the more I like the database approach. Maybe we need to stop thinking about it as "binary" versus "text", and think about it as different degrees of data abstraction.

I don't really think that that's the issue. I really do think that there's just some misunderstanding going on. I mean, I haven't been saying "don't use SQL" or "the relational model sucks!" I've been saying "I want to be able to read my log files with any old tool, but adding in a query engine would be cool too." The only issue that could arise with what I want is performance. And not only do I think log files aren't likely to have this issue; but I think that it can be solved without abandoning text.

Reply Parent Score: 2