Optimal databasesystem for filters


I am building a website that implements filters that can be applied to a dataset. Allow me to explain these filters. In this case it will be a website with houses.

Number of rooms:
    2 or less ( 2271 )
    3 or more ( 4283 )
    4 or more ( 2223 )
    5 or more ( 1213 )

Price range
    More then {fill in number}
    Less then {fill in number}

    For sale ( 2938 )
    For rent ( 1029 )

You see it more frequently these days. It would be a total of about 7 filters.

Now I am not sure what kind of database I should use. There will be about 10000 entities and daily changes (about 1% of the dataset). The two that I am considering are:

MongoDB Object Oriented

First of all, I am new to these -so called- object oriented databases. But I have heard some good stories about them. They are scheme less and likely very fast at the job.

MySQL Relational database

I have used the MySQL before in this situations, the performance was acceptable. I used a EAV-Model that makes the database more dynamic. I used a InnoDB engine with relations to maintain the integrity.

The problem is that when I use multiple filters the subqueries stack up, this happens when I calculate the number of posibilities when u select the filter.

What do think about the performance in this situation, what dbms would perform better?


You can use either.
if u use a denormalized table in mysql (i.e. no joins) it is similar to an object in mongoDB although harder to query.
So, if can have your data de-normalized in a sensible way, go with Mongo Otherwise, RDBMS.

With 10,000 records, the performance should be decent in MySQL. Since you are already familiar with MySQL, I will recommend that you use that. You can try GROUP BY ... WITH ROLLUP as described here to get the job done with just one query. MySQL as well as your client will need to do some extra work, but I think it will be offset by the reduction in the number of queries.

By : nikhil500

This video can help you solving your question :)
By: admin