1. A method in a distributed database system comprising: receiving a query in a query language from a client with a distributed database system, wherein the distributed database system comprises a scalable NoSQL database implemented with a shared-nothing architecture; locating an index that matches the query, wherein the index is pre-generated from a database table in the distributed database system, wherein the query comprises, a WHERE clause, and wherein the index comprises a data structure created using one or more columns of the database table based on the WHERE clause; implementing a map function of a MapReduce programming model using the index; implementing a reduce function of the MapReduce programming model using the output of the map function, wherein the reduce function is not performed when the value of she output of the map function is unique; and implementing a finalize function using the output of the reduce function, wherein the finalize function obtains a list of key/value pairs of a reduce function output and returns a finalized value and returns another list of key value pairs as an output.