SQL Server Performance

select query to table 20 million rows with like

Discussion in 'T-SQL Performance Tuning for Developers' started by d17may, May 23, 2007.

  1. d17may New Member

    I have a table which has about 1-20 million rows .I execute query againt this
    table in my where clause i have like against 2 columns .I want to execute this
    query very fast.This query execution rate is very fast.
    The table is now in single hard disk .I can add more hard disk to the system.
    Can i distribute the load of this query to all the hard disk so that it execute
    parallely .I also need some guide ,tutorial for parallel processing with sql server.

    Thanks
    d17may
  2. ndinakar Member

    Check if you have proper indexes first and if the stats are upto date. Does your LIKE statement look like :


    SELECT
    FROM
    WHERE comecol LIKe '%something'

    If so, the SQL Engine will not use any indexes. Try to narrow the search. These kind of things will give you more benefit vs adding hardware.

    ***********************
    Dinakar Nethi
    SQL Server MVP
    ***********************
    http://weblogs.sqlteam.com/dinakar/
  3. MohammedU New Member

    Post your query....
    As Dinakar mentioned....in the where clause while card should be at the end of the word not at the begining to use indexes...


    MohammedU.
    Moderator
    SQL-Server-Performance.com

    All postings are provided “AS IS” with no warranties for accuracy.
  4. d17may New Member

    User enter keywords and i have to find the mathching columns which has this keyword.For e.g. user enter aaa bbb
    My table has data like
    col1
    aaa;www;df;
    ee;tt;
    aaa;bbb;

    i want 1 and 3rd row .this is oltp database.This query is executing very frequently. where clause is col1 like '%dddd%' and col1 like '%www%' .


    Thanks
    d17may
  5. Adriaan New Member

    In this case you have to normalize the data, adding a child table for the individual keywords, instead of listing them as a single string.
  6. Madhivanan Moderator

  7. Adriaan New Member

    Madhi, question is not about passing arrays, it is about filtering on an multi-value column.

Share This Page