MySQL Editing
Some RDBMSs seem to have some ability in this regard.
In Mysql there is some kind of index "joins" according to the documentation .
[Before MySQL5] MySQL was able to use no more than one index for each reference table
But at 5, it supports limited index merging.
You really need to understand how indexes work and when they are useful. What percentage of rows does a full table scan make more sense than an index? Do you think that in some scenarios FTS is cheaper than scanning an index that returns 2% of rows? If the histogram of your bedroom looks like this: 1 = 25%, 2 = 50%, 3 = 20%,> 3 = 5% ... The only time the index in this column is useful is to find more than 3 bedrooms, t use it then due to binding variables and clustering factors.
think of it like that. Suppose my bedroom percentage is correct. Let's say you have 8k pages (dunno what Mysql uses) and each row is 80 bytes long. Ignoring the overhead, you have 100 lines (lists) per disk page. Since the houses are added in random order (random as the bedrooms go) on each page, you will have 50 2-bedroom houses, 25 1-bedroom houses, 20 3-bedroom houses and maybe 4 or 5 or so on this page Each page will have at least one 1-bedroom house, so you will read EVERY page for BEDROOMS = 1, the same for 2, the same for 3. This can help for 5-bedroom houses ... but if MySQL will bind the variable operation as Oracle, then it will not change plans for the given value of the Bedroom.
As you can see, there is much to understand ... More than John Skeet pointed out.
Original post
Most DBMSs cannot combine indexes in one table. If you have a table with columns A, B and C with indexes with one column on A, B and C. and you search, where A = a and B = b and C = c. He will choose the most selective index and will use only one.
If you create one, multi-column index in A, B, C, then this index will not work unless you include A = a in WHERE. If your B = b and C = c, then this index is ignored - in most DBMSs.
This is why Oracle invented the Bitmap index. The Bitmap index on A, B, and C can be combined with bitwise AND bitwise OR operations. Until the final set of Rowids and the selected selected columns are determined.
The bitmap index in the REGION column is displayed in the last four columns.
Row Region North East West South 1 North 1 0 0 0 2 East 0 1 0 0 3 West 0 0 1 0 4 West 0 0 1 0 5 South 0 0 0 1 6 North 1 0 0 0
So, if you say that you want a house where the region is located (north, east). You are beaten by the index of the North and East indices and end in rows 1, 2, 6
If you have another bedroom column, for example
Row Bedrooms 1BR 2BR 1 1 1 0 2 2 0 1 3 1 1 0 4 1 1 0 5 2 0 1 6 2 0 1
if you And Bedrooms = 2, this index will return 2, 5, 6 and when Bitwise AND'ed in the Region column will result in rows 2 and 6.
But since you could not mention the DBMS, I may have completely lost my time. Oh, OK.