user3649739 user3649739 - 1 month ago 17
MySQL Question

Combine Mysql and Sphinx Queries?

I have a very efficient Sphinx query working on a table. However part of the query unfortunatley requires a large 'OR' statement consisting of 100s of options. Sphinx chokes on

@(field) (1|2|..|800)


pretty badly taking as long as one minute while the same pipe query in Mysql takes <1 second whether doing

field in (1,2,..,800


or even

Field =1 or Field=2 or Field=... or Field=800
.

Is there a way to combine both in one query?

Answer

Sphinx can do in(..) queries on ATTRIBUTEs.

Probably not as efficiently as mysql (at least if indexed column)

sphinxQL> SELECT * FROM index WHERE MATCH('...') AND attrib IN (1,2,...) 
Comments