On various websites there is a search bar that already depicts the amount of results you will get per option you can select.
In some cases there is a tenfold of options you can choose from and for each option you already see if you select this option you will get 102 results, 88 results, etc. This is all provided within a fraction of a second.
Does anybody know how this is done? In case you use a relational database you will have to run thousands of queries to calculate the result for each option, per user checking the website. This will take too much time. Also caching every possible option is almost impossible, since it will generate millions of possibilities and whenever something changes you can start caching again.
Is there some other kind of decision-tree database that already provides the amount of results per option?
See for example this house-search website where you can select tens of options for the house you are looking for (menu at the left hand side).