Often we need to check how many site collections (SPSites) and web sites (SPWeb) are created by content producers in living production system (e.g. when dealing with performance issues). For those cases if you don’t want to check it manually via Central Administration or Sharepoint site UI, you can just perform the following SQL queries on content database:
It will show you the number of created sites (table Webs) and site collections (table Sites). This little tip may help if you want to perform quick calculation of Sharepoint resources.