Sphinx Deltaindex
2008-01-05 – 11:35Har nu gjort om hur Sphinx gör sin deltaindexering och gick först från 6 timmar ner till 2 timmar och nu är jag nere i ca 1 minut:
$ time /usr/local/bin/indexer --rotate deltaindex_swedish Sphinx 0.9.8-dev (r985) Copyright (c) 2001-2007, Andrew Aksyonoff using config file '/usr/local/etc/sphinx.conf'... indexing index 'deltaindex_swedish'... collected 25375 docs, 18.8 MB sorted 2.0 Mhits, 100.0% done total 25375 docs, 18824703 bytes total 58.788 sec, 320212.09 bytes/sec, 431.63 docs/sec rotating indices: succesfully sent SIGHUP to searchd (pid=15596). real 0m58.817s user 0m1.120s sys 0m0.140s $
Hur gjorde jag då? Jo jag sket i mina egna SQL-frågor och gick istället på det som rekommenderas:
Example 3. Fully automated live updates
# in MySQL CREATE TABLE sph_counter ( counter_id INTEGER PRIMARY KEY NOT NULL, max_doc_id INTEGER NOT NULL ); # in sphinx.conf source main { # ... sql_query_pre = REPLACE INTO sph_counter SELECT 1, MAX(id) FROM documents sql_query = SELECT id, title, body FROM documents \ WHERE id<=( SELECT max_doc_id FROM sph_counter WHERE counter_id=1 ) } source delta : main { sql_query_pre = sql_query = SELECT id, title, body FROM documents \ WHERE id>( SELECT max_doc_id FROM sph_counter WHERE counter_id=1 ) }
Du bör också läsa något av följande inlägg:





