ADHEAVEN - Natali Ardianto Official

COO tiket.com. Advisor bouncity.com. Advisor golfnesia.com. Co-founded urbanesia.com. Initiator #StartupLokal

January 7, 2012 12:07 am

Using Sphinx as denormalized table: Need your point of view

Hey guys, I need your point of view on this. So I have this query, which can take up to 17 (Seventeen!) tables into one query. I have been using Sphinx a lot for searches, and luckily, since Sphinx 1.10-beta, we have this attribute called sql_attr_string. What this attribute does is store the value for retrieval at Sphinx. So this is what I get (below is a sphinx index):

mysql> select room_date, room_name FROM rooms LIMIT 5;
+-----------+--------+-----------+---------------+
| id        | weight | room_date | room_name     |
+-----------+--------+-----------+---------------+
| 120120106 |      1 |  20120106 | Superior Room |
| 120120107 |      1 |  20120107 | Superior Room |
| 120120108 |      1 |  20120108 | Superior Room |
| 120120109 |      1 |  20120109 | Superior Room |
| 120120110 |      1 |  20120110 | Superior Room |
+-----------+--------+-----------+-------------------+
5 rows in set (0.01 sec)

So as you can see, I don’t need to query my tables anymore, basically sphinx search is doing the hard work by indexing ALL tables (schedule in background), and updates anything necessarily by using real-time indexing.

Reading the manual, it says that searchd will cache all values in RAM. But I think that’s before 1.10-beta. I need your PoV on this. Is this plausible or is this consuming a lot of Sphinx Search resource?