Well depends on the case, I needed a fast ip to country resolving, really fast one. I did my database in C for it and it was 120 times (yes!) faster than fully optimized postgres table, not to mention memory, disk and cpu footprint.
Custom made database for just a specific problem can be a lot faster than generic one. But depends on your knowlidge.