I know how you can implement an easy database and index over some posts - simply keep that posts values inside a balanced tree of some kind.

What this is all about, is when would AND queries be effectively implemented? How does one implement something similar to

SELECT * FROM points WHERE x > 0 and x < 4 and y > 10 and y < 14

Observe that I am not asking particularly about database, but instead which data structure might be best with this used, for 2 dimensional queries. I recall studying once about Range Trees - is the real life fix for your problem?

You are able to very effectively do this having a regular search tree...

you may also do that within an O(N), scan within the entire data, that is things i guess most DBs do more often than not. especially thinking about the price of indexes.

in whatever way this is actually the most typical and straightforward type of indexes, supported in many DBs: http://en.wikipedia.org/wiki/B-tree so if you're searching for a variety within the index its relatively simple to optimize...

Incidentally consider also that you're expecting the DB to know you're searching for ranges and optimize based on that, because In most cases symbolises that you're just needing two conditions....