Jeff S Wheeler writes:
 > Tried to post this to mailing.database.mysql, but earthlink's news servers
 > suck, and it seems the message got dropped.  Bleh.  Anyway..:
 > 
 > Jeff S Wheeler <[EMAIL PROTECTED]> wrote in message news:...
 > Below is a filled-out mysqlbug form.  Indexes on HEAP tables are ignored in
 > numerous queries in which I think they should be utilized, but this is the
 > first I've noticed where mysql actually _does_ use the index, and as a
 > result it produces wrong query results.
 > 
 > Description:
 >  Adding an index to a HEAP table breaks WHERE col LIKE "502-%"
 > 
 > How-To-Repeat:
 > mysql> SELECT COUNT(*) FROM t4 WHERE BillN LIKE "502-%"\G
 > *************************** 1. row ***************************
 > COUNT(*): 4378
 > 1 row in set (0.03 sec)
 > 
 > mysql> CREATE INDEX BillN ON t4 (BillN);
 > Query OK, 42854 rows affected (0.15 sec)
 > 
 > 
 > mysql> SELECT COUNT(*) FROM t4 WHERE BillN LIKE "502-%"\G
 > *************************** 1. row ***************************
 > COUNT(*): 0
 > 1 row in set (0.00 sec)
 > 
 > Fix:
 >  Do not use indexes on HEAP tables.  Of course, I really would like to
 >  be able to use them, as I have a nasty LEFT JOIN that would be really
 >  fast in comparison, if it wouldn't improperly return zero rows.
 > 
 > Submitter-Id:
 > Originator: Jeff S Wheeler <[EMAIL PROTECTED]>
 > Organization: Five Elements, Inc.
 > MySQL support: none
 > Synopsis: Indexes break some queries on HEAP tables
 > Severity: serious
 > Priority: low
 > Category: mysql
 > Class:  sw-bug
 > Release: mysql-3.23.33-pc-linux-gnu-i686 (Binary distribution)
 > 
 > Environment:
 > 
 > System: Linux neptune 2.4.2 #2 SMP Tue Mar 13 22:15:19 EST 2001 i686 unknown
 > Architecture: i686
 > 
 > Some paths:  /usr/bin/perl /usr/bin/make /usr/bin/gcc /usr/bin/cc
 > GCC: Reading specs from /usr/lib/gcc-lib/i386-linux/2.95.2/specs
 > gcc version 2.95.2 20000220 (Debian GNU/Linux)
 > Compilation info: CC='gcc'  CFLAGS='-O2 -fomit-frame-pointer'  CXX='g++'
 > CXXFLAGS='-O2 -fomit-frame-pointer -felide-constructors -fno-exceptions -fno
 > -rtti'  LDFLAGS=''
 > Configure command:
 > ./configure  --enable-shared --without-readline --enable-assembler --with-my
 > sqld-user=mysql --with-unix-socket-path=/var/run/mysqld/mysqld.sock --prefix
 > =/usr --exec-prefix=/usr --libexecdir=/usr/sbin --sysconfdir=/etc/mysql --da
 > tadir=/usr/share --localstatedir=/var/lib/mysql --infodir=/usr/share/info --
 > includedir=/usr/include --mandir=/usr/share/man
 > Perl: This is perl, version 5.005_03 built for i386-linux
 > 
 > 


Hi!

Our manual specifies very clearly that indices in HEAP tables can be
used only for = and !=.

Therefore, for the case like above, you are better without it.


Regards,

Sinisa

      ____  __     _____   _____  ___     ==  MySQL AB
     /*/\*\/\*\   /*/ \*\ /*/ \*\ |*|     Sinisa Milivojevic
    /*/ /*/ /*/   \*\_   |*|   |*||*|     mailto:[EMAIL PROTECTED]
   /*/ /*/ /*/\*\/*/  \*\|*|   |*||*|     Larnaca, Cyprus
  /*/     /*/  /*/\*\_/*/ \*\_/*/ |*|____
  ^^^^^^^^^^^^/*/^^^^^^^^^^^\*\^^^^^^^^^^^
             /*/             \*\                Developers Team

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to