freelancing-god/thinking-sphinx — Issue #311: STI & avoiding SELECT DISTINCT type FROM table
Author: cmaion
Created: 2011-11-27 18:21:33+00:00
State: open

Hey,

I've a large STI table indexed by TS.
TS is running a "SELECT DISTINCT type FROM table" when starting, which is very slow (no SQL index on the type column -- I don't need it).

Tracking this takes me to type_values in lib/thinking_sphinx/source/sql.rb.

I was wondering if there's a good reason to discover types by running this expensive SQL request when starting, instead of just looking at Rails classes? (Model.descendants gives the result instantaneously).

Thanks,
Cedric