SQL is generalized. Their solution is specialized. That's enough for significant gains when the data doesn't fit the way SQL was designed. It looks like both would be querying for IPs against a database of IP ranges -- this is not something that most SQL servers have a built in facility for. Also, On top of that, if you're accessing the data directly, you don't have any connection overhead either, which when you're talking about millions of requests per second gets pretty significant. Using a huge DBMS to do a simple lookup like this is really using the wrong tool for the job -- but it's a tool most people have access to and know how to use, and it's one that does a good enough job in most cases. SQL servers are really designed for relational data though, not simple lookup tables, and while it can be done, it'd be a lot of work to design a specialized relational file format that can outperform a good DBMS. Indexed tables like this are a cakewalk in comparison.
If you want blindingly fast SQL, try SQLite, while it's not as featureful as many DBMS's, it provides a lot of functionality and is extremely fast. There are other concerns with locking and such, but for raw performance it's about as fast as you can get with SQL-compliant queries.
When you look at databases they can be fast. Well they are. But, in some cases in might be faster to access a file directly on the disk. That's faster. First of all using a database you need to connect to the database. That takes a few seconds, then you need a good database design with a good SQL query and some good indexes to get a speedy response. When you simply want fast search queries you could choose to use something like Full Text Searching. Most databases (for example MS SQL Server and MySQL) do support this. You will get magicly fast queries and you can even do some fussy matching (that's searching right!). The scripts you mention need to be able to handle heavy loads of traffic. That's why they choose binary. Connecting to database etc etc would take more time. These days (like with ASP.NET) you can easily implement caching of data which would make it easier to choose for a database instead of file on disk. Caching really makes a big difference.
Cheap DotNet Hosting
Windows hosting with ASP.NET and SQLServer support.
24x7 Support Center! Prices are cheap, join today!