Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase «««1234

Need Help on Fastest Search Logic Expand / Collapse
Author
Message
Posted Sunday, October 13, 2013 1:00 PM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Saturday, August 16, 2014 8:16 AM
Points: 107, Visits: 513

You could be right but the FTI wouldn't be on Table 2 according to the OPs latest post. It would only be needed on Table 1. Fortunately, I don't see any requirements to join Table 1 to Table 2 under such conditions.


Wasn't the requirement to search the rows in Table2 for those that matched a row in Table1? That was how I read it.
Post #1504284
Posted Sunday, October 13, 2013 1:34 PM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Yesterday @ 11:34 PM
Points: 36,952, Visits: 31,461
lnardozi 61862 (10/13/2013)

You could be right but the FTI wouldn't be on Table 2 according to the OPs latest post. It would only be needed on Table 1. Fortunately, I don't see any requirements to join Table 1 to Table 2 under such conditions.


Wasn't the requirement to search the rows in Table2 for those that matched a row in Table1? That was how I read it.


Ah. Yes... that was the original problem. I thought you were talking about the lastest request which is...

born2achieve (10/13/2013)
Hi Jeff,

am back,

i got one more tricky situation from my client. i frightened to hear about this concept from them. the concept will be i will have to take the product name from table 1 and search it with %product name% search condition. not whole word matching.

In your example, after we split the comma separated values into temp table , fetch each item from table 1 and we have map it with %table1.productname% onto temp table. i am wondering about this ugly concept. because it will kill the time. do you have any suggestion on this concept. sample below,

if the product name on table 1 is "milk" and on the temp table if we have "milk with fat","milk with out fat","milk with less fat" then we have to fetch these three product name. for this i hope we should have to use % table1.productname %.

could you please


Going back to the original problem and considering how fast the solution turned out to be to do that, I don't believe that I go through setting up FTS for that. Shifting gears to my original suggestion, what they really need to do is to store the data in a normalized format rather than using the CSV column. The fast solution actually does just exactly that... if changes the denormalized Table 2 to a normalized version and then does a normal join to that. Still, it would be better to avoid such on-the-fly normalization or FTS by properly normalizing Table 2 to begin with.


--Jeff Moden
"RBAR is pronounced "ree-bar" and is a "Modenism" for "Row-By-Agonizing-Row".

First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."

(play on words) "Just because you CAN do something in T-SQL, doesn't mean you SHOULDN'T." --22 Aug 2013

Helpful Links:
How to post code problems
How to post performance problems
Post #1504286
Posted Sunday, October 13, 2013 4:22 PM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Saturday, August 16, 2014 8:16 AM
Points: 107, Visits: 513

Going back to the original problem and considering how fast the solution turned out to be to do that, I don't believe that I go through setting up FTS for that. Shifting gears to my original suggestion, what they really need to do is to store the data in a normalized format rather than using the CSV column. The fast solution actually does just exactly that... if changes the denormalized Table 2 to a normalized version and then does a normal join to that. Still, it would be better to avoid such on-the-fly normalization or FTS by properly normalizing Table 2 to begin with.

--Jeff Moden


I never seem to be able to sell people on denormalizing the data and creating a view with an Instead Of trigger that looks like the original table. It's the best of both worlds - you get to do things like God intended without all the bother of actually changing your application. True, writes aren't nearly as performant but many applications read lots of rows, but tend to write them one at a time.
Post #1504292
« Prev Topic | Next Topic »

Add to briefcase «««1234

Permissions Expand / Collapse