1. A method of optimizing a query in a multi-tenant database, said database having one or more data tables, each table having one or more logical columns defining data categories and one or more logical rows associated with one or more tenants, wherein a plurality of tenants have data stored in the data tables, the method comprising: generating tenant-level statistics for each of said plurality of tenants for each of the data tables; receiving a SQL query and an identification of a tenant associated with the query; and optimizing the SQL query based on the tenant-level statistics for the tenant associated with the query.