• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

The xf_search_index table can be truncated if using XFES

Brogan

XenForo moderator
Staff member
#1
For those of you who aren't aware, if you're using XFES you can truncate the xf_search_index table, as it is no longer used.

On a large site, that will reduce the DB size by a considerable amount, (potentially) resulting in less server space being utilised, quicker backups, etc.

phpMyAdmin
Code:
TRUNCATE 'xf_search_index';
SSH
Code:
TRUNCATE TABLE xf_search_index;
 

DBA

Well-known member
#6
The index is stored in the location set up on elasticsearch on your server, not in mysql:)
Assumed as much, thanks! (y)

I dig being able to search down to single characters, which is one of the main reasons I'm using it (my niche has a lot of 2-3 letter acronyms).
 

DeltaHF

Well-known member
#11
Wish I had seen this earlier! I would recommend a sticky for this topic, and you might want to mention it as an extra step in your ES setup guides, @Slavik.

I reduced the size of my database (imported vB 3.8 forum, 9.4 million posts) on disk from 30GB down to 6.5GB. :D This is definitely going to make backups a lot easier (and cheaper!).
 

Rudy

Well-known member
#13
I lucked out and had XFES installed from day one, before we imported the forum. Our test forum, though, probably has an index table to truncate.
 

Floren

Well-known member
#15
@Slavik, @Brogan: I have a question about xf_search table usage. Even if I use Elasticsearch with XES 1.0.3, it still create new entries into xf_search table when I perform a search... is this normal?
Code:
MariaDB [axivo]> truncate table xf_search;
Query OK, 0 rows affected (0.22 sec)
### Search performed on website...
MariaDB [axivo]> select search_id, result_count from xf_search;
+-----------+--------------+
| search_id | result_count |
+-----------+--------------+
|         1 |           22 |
+-----------+--------------+
First, I thought is related to new http.jsonp.enable setting but even with it commented I still get search entries into table. I guess is for caching purposes so it returns the result directly from table? It should not IMO.
Code:
# curl localhost:9200
{
  "status" : 200,
  "name" : "Tutinax the Mountain-Mover",
  "version" : {
    "number" : "1.3.1",
    "build_hash" : "2de6dc5268c32fb49b205233c138d93aaf772015",
    "build_timestamp" : "2014-07-28T14:45:15Z",
    "build_snapshot" : false,
    "lucene_version" : "4.9"
  },
  "tagline" : "You Know, for Search"
}
 
Last edited: