There's this weird dichotomy where people think the folks that work in government are either evil geniuses or drooling cavemen. They are neither. I assure you that the NSA (with unlimited funding) is capable of running a MySQL cluster to index email and keep it up, most of the time anyway.
Also, Snowden didn't build the query system, he just used it. He built a document gathering system, which I described in my other response. These are different services.