Re: [GENERAL] Need some advice on a difficult query

2009-12-16 Thread Mike Christensen
Thanks! The queries I wrote in my email were just an example, my actual implementation specifies all column names required and also uses full text search. I just didn't want to paste in that much cruft :) I'll do some tests with your technique below and see which works better.. Mike On Wed, De

Re: [GENERAL] Need some advice on a difficult query

2009-12-16 Thread Sam Mason
On Wed, Dec 16, 2009 at 12:47:36AM -0800, Mike Christensen wrote: > When the user searches for a new pasta dish, the UI would generate a query > something like this: > > SELECT * FROM Recipes where RecipeTitle ilike '%pasta%'; > > I only need the data from the recipes table since I display a summ

Re: [GENERAL] Need some advice on a difficult query

2009-12-16 Thread Timo Klecker
Hi Mike, here is an untested "weird nested query" for your problem: SELECT * FROM Recipes r where lower(RecipeTitle) like lower('%pasta%') and not exists (select 1 from ingredients inner join blacklist using (IngredientId) where RecipeId = r.RecipeId and blacklist.UserId = 123 limit 1);

Re: [GENERAL] Need some advice on a difficult query

2009-12-16 Thread Mike Christensen
Awesome, I'll give this a shot.. Blacklist.UserId will be indexed and all the recipe links are of course already indexed, but I'll run it under the query analyzer to see if there's any other fine tuning needed. I appreciate your help! Mike On Wed, Dec 16, 2009 at 1:27 AM, Timo Klecker wrote: