Not sure exactly what you're referring to - can you provide the SQL statement and point out what you think could be more efficient?
Cheers
--
Pat
> --
> You received this message because you are subscribed to the Google Groups "Thinking Sphinx" group.
> To view this discussion on the web visit https://groups.google.com/d/msg/thinking-sphinx/-/C_gW49zbm6kJ.
> To post to this group, send email to thinkin...@googlegroups.com.
> To unsubscribe from this group, send email to thinking-sphi...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/thinking-sphinx?hl=en.
Hi RogerNot sure exactly what you're referring to - can you provide the SQL statement and point out what you think could be more efficient?
Cheers
--
PatOn 29/07/2012, at 5:06 PM, Roger Kind Kristiansen wrote:
> Hi again,
>
> I just noticed that the SQL generated to my sphinx config returns a bit more than I expected. I'll not dig to deep into my data model or concrete indices first, as I assume this is yet another silly newbie mistake which is easy to pinpoint.
>
> I've got one model which has a few associations (most are through a join table, but not all). I've set up some indices and some attributes making use of these associations. Now when I manually run the SQL generated by TS, I notice the same values from the associated models are repeated multiple times in each column. Is this expected behaviour, or is there some obvious thing I'm missing which TS doesn't do for me automatically, like some explicit grouping or unique constraints or something?
>
> This hasn't caused me any trouble up until now, but now I'm trying to sort by counting the number of entries in one of the associated models and the numbers get all screwy. As far as I can understand it's related to the mentioned duplication.
>
> Cheers,
> Roger
>
> --
> You received this message because you are subscribed to the Google Groups "Thinking Sphinx" group.
> To view this discussion on the web visit https://groups.google.com/d/msg/thinking-sphinx/-/C_gW49zbm6kJ.
> To post to this group, send email to thinking-sphinx@googlegroups.com.
> To unsubscribe from this group, send email to thinking-sphinx+unsubscribe@googlegroups.com.
One thing that may be worth trying is being a little more explicit with your association references:
indexes doctors_practices.practices.name, :as => :practice_name
indexes doctors_practices.counties.name, :as => :counties
This should hopefully avoid the doubling up on joins. Also, I'd suggest there's not much point making these columns sortable, given they're aggregated values.
If that doesn't help, let me know - although the SQL joins are something managed by Rails, so there's limitations in how much they can be modified.
Cheers
--
Pat
> > To post to this group, send email to thinkin...@googlegroups.com.
> > To unsubscribe from this group, send email to thinking-sphi...@googlegroups.com.
> > For more options, visit this group at http://groups.google.com/group/thinking-sphinx?hl=en.
>
>
>
>
>
>
>
>
>
>
> --
> You received this message because you are subscribed to the Google Groups "Thinking Sphinx" group.
> To view this discussion on the web visit https://groups.google.com/d/msg/thinking-sphinx/-/9_XhUmvM8NQJ.
> To post to this group, send email to thinkin...@googlegroups.com.
> To unsubscribe from this group, send email to thinking-sphi...@googlegroups.com.