Page 2 of 2 FirstFirst 12
Results 11 to 14 of 14
  1. #11

    Default Re: SQL: Using LIKE statement on a clustered Index


    yeah i think #2 would be faster too.

    cuz the first query is going to do a 'X?' on each employee entry

    while substring (....) = 'A' is going to match it directly


  2. #12

    Default Re: SQL: Using LIKE statement on a clustered Index

    back to the topic of SQL optimization of Silent-Kill

    We are all aware that clusters primary purpose is to improve performance of any queries that has two or more tables but still it has a downside and performance becomes worse when accessing one table individually. Using (select * from process where ID like 'Proc00001%') with Oracle databases is not a good idea. My advice, never use it with Oracle since it is a single table you are accessing but for mySQL it’s a different story because it improves the performance when clustered even if you’re just using a single table. I am also confused with other database clustering behavior. This is a bit confusing right? Welcome to the world of the Infinite Learning! Hehehe!

  3. #13

    Default Re: SQL: Using LIKE statement on a clustered Index

    Quote Originally Posted by javapenguin
    I tested the two in a large table without index in MySQL using MyISAM as table type. My guess is the same as cold fusion but #2 is surprisingly faster.

    SELECT count(*) FROM sales1 WHERE itemcode like '048%';
    41.24 sec

    SELECT count(*) FROM sales1 WHERE substring(itemcode,1,3) = '048';
    23.03 sec

    I tested another table, but this time substring goes first.

    SELECT count(*) FROM sales2 WHERE substring(itemcode,1,3) = '048';
    59.18 sec

    SELECT count(*) FROM sales2 WHERE itemcode like '048%';
    1 min 7.81sec

    #2 is still faster, is there a logical explanation to this?

    thank you very much for the effort.

    thanks all.

  4. #14

    Default Re: SQL: Using LIKE statement on a clustered Index

    Your welcome

  5.    Advertisement

Page 2 of 2 FirstFirst 12

Similar Threads

 
  1. Help using MS Access on an inventory program
    By jinkazjinkaz in forum Programming
    Replies: 25
    Last Post: 09-11-2010, 09:37 PM
  2. question about using desktop installer on my laptop
    By Leartes in forum Software & Games (Old)
    Replies: 2
    Last Post: 07-08-2009, 07:40 PM
  3. President Arroyo's statement on the Makati standoff 11-29-07
    By cyberdud3 in forum Politics & Current Events
    Replies: 95
    Last Post: 12-17-2007, 01:12 PM
  4. Replies: 5
    Last Post: 02-08-2006, 11:16 PM
  5. Replies: 3
    Last Post: 07-07-2005, 04:26 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
about us
We are the first Cebu Online Media.

iSTORYA.NET is Cebu's Biggest, Southern Philippines' Most Active, and the Philippines' Strongest Online Community!
follow us
#top