user3649739 user3649739 - 1 year ago 126
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 Source

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,...) 
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download