what would be faster

  • Assume all columns in mention here are text fields...What would be faster?

    A SELECT on

    Where

    (

    col1 like 'insurance%'

    or

    col2 like 'department%'

    or

    col3 like 'pension%'

    )

    Or mashing all three columns into one larger text field and doing a SELECT LIKE on the one column?

    Is there any best practices on speeding up a text field search?

     

     

     

     

     

  • I know 2 guys who definetely know the best practices on speeding up a text field search.

    They used their knowledge to create Google.

    May be ask them?

    _____________
    Code for TallyGenerator

  • First, not sure how you'd do a like with the values "mashed" together even if you were looking at a single column.  I can tell you that anytime you can avoid "mashing" things together, you'll probably end up with the speedier solution.  There are, of course, exceptions to that general rule.... but I don't think this is one of them.  The LIKEs you have will actually perform quite nicely.

    --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.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply