1. A method for automatic allocation of tenants to a predetermined number of databases, the method comprising: determining a query plan based on a workload for each tenant; creating a distance metric based on the query plan for each tenant; and clustering tenants based on the distance metric into a predetermined number of clusters which is equal to the predetermined number of databases.