List:General Discussion« Previous MessageNext Message »
From:John Stoffel Date:September 28 2010 5:06pm
Subject:Re: Howto optimize Distinct query over 1.3mil rows?
View as plain text  
Johnny> BIB_ID is VARCHAR, you should probably try
Johnny> WHERE BIB_ID='464' so MySQL treats the value as a string

Wow!  What a difference that makes!  Time to A) update my queries, or
B) fix the DB schema to NOT use varchar there.  

    mysql> select SQL_NO_CACHE distinct(Call_No) from Newspaper_Issues
    mysql> WHERE BIB_ID = 464;
    +----------+
    | Call_No  |
    +----------+
    | News     | 
    | NewsD CT | 
    +----------+
    2 rows in set (3.06 sec)

    mysql> select SQL_NO_CACHE distinct(Call_No) from Newspaper_Issues
    mysql> WHERE BIB_ID = '464';
    +----------+
    | Call_No  |
    +----------+
    | News     | 
    | NewsD CT | 
    +----------+
    2 rows in set (0.02 sec)

Thanks a ton for your help, I would have never figured this out, esp
since I was looking down all the wrong rat holes.  

Thanks,
John
Thread
Howto optimize Distinct query over 1.3mil rows?John Stoffel28 Sep
  • Re: Howto optimize Distinct query over 1.3mil rows?Johnny Withers28 Sep
    • Re: Howto optimize Distinct query over 1.3mil rows?John Stoffel28 Sep
  • Re: Howto optimize Distinct query over 1.3mil rows?Johan De Meersman28 Sep