1. A method of optimizing a query in a multi-tenant database, said multi-tenant 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: determining database indices for one or more of the data tables; generating tenant-level statistics for one or more of said plurality of tenants for one or more of the data tables; receiving a SQL query; optimizing the SQL query based on the database indices; and optimizing the SQL query based on the tenant-level statistics, thereby enabling SQL query optimization according to greater semantic knowledge of use of the data tables.