Re: optimizer bug in selecting fields that dont belong to the index used by mysql/Innodb

2002-10-09 Thread Heikki Tuuri

Rafa,

it looks like the tuning I did to 3.23.53 fixes the optimization also in the
'albaranes' case below.

Lenz starts building of 3.23.53 this week. With good luck 3.23.53 is
available around Oct 17, 2002.

Best regards,

Heikki
Innobase Oy


heikki@hundin:~/mysql/client mysql test
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2 to server version: 3.23.53-log

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql select count(*) from albaranes;
+--+
| count(*) |
+--+
|46100 |
+--+
1 row in set (0.59 sec)

mysql explain select * from albaranes where alb 'SA' limit 10
- ;
+---+---+---+-+-+--+---+

+
| table | type  | possible_keys | key | key_len | ref  | rows  |
Extra
|
+---+---+---+-+-+--+---+

+
| albaranes | range | PRIMARY   | PRIMARY |   8 | NULL | 44491 |
where u
sed |
+---+---+---+-+-+--+---+

+
1 row in set (0.00 sec)

mysql explain select * from albaranes where alb 'BA' limit 10
- ;
+---+---+---+-+-+--+---+

+
| table | type  | possible_keys | key | key_len | ref  | rows  |
Extra
|
+---+---+---+-+-+--+---+

+
| albaranes | range | PRIMARY   | PRIMARY |   8 | NULL | 44491 |
where u
sed |
+---+---+---+-+-+--+---+

+
1 row in set (0.00 sec)

mysql explain select * from albaranes where alb 'MA' limit 10
- ;
+---+---+---+-+-+--+---+

+
| table | type  | possible_keys | key | key_len | ref  | rows  |
Extra
|
+---+---+---+-+-+--+---+

+
| albaranes | range | PRIMARY   | PRIMARY |   8 | NULL | 44491 |
where u
sed |
+---+---+---+-+-+--+---+

+
1 row in set (0.00 sec)

mysql explain select * from albaranes where alb  'SB' limit 10
- ;
+---+---+---+-+-+--+---+

+
| table | type  | possible_keys | key | key_len | ref  | rows  |
Extra
|
+---+---+---+-+-+--+---+

+
| albaranes | range | PRIMARY   | PRIMARY |   8 | NULL | 44491 |
where u
sed |
+---+---+---+-+-+--+---+

+
1 row in set (0.00 sec)

- Original Message -
From: [EMAIL PROTECTED]
Newsgroups: mailing.database.mysql
Sent: Wednesday, October 09, 2002 1:17 PM
Subject: optimizer bug in selecting fields that don´t belong to the index
used by mysql/Innodb


 Description:
   Hello,

   We reported a problem about selecting fields that some of them didn´t
belong to
   the used index on September.

   We have already installed MySql 4.0.4 and we have a similar problem
   (and also we are still having the original problem) when we select
fields which some of them
   don´t belong to the primary index that MySql should use in the search.
In this query,
   we haven´t any OR condition in the WHERE clause as we had in the query
that we made
   on September. Moreover, in this case MySQL doesn´t use any index when
runs the query. So,
   we think this problem is bigger than the previous one.

   We have sent to ftp://support.mysql.com/pub/mysql/secret the table
definition
   and data (albaranes.txt) in a compressed file named Albaranes.zip so you
can
   reproduce the bug.

   We hope the test we are going to explain can help you to fix the bug.

   Now, the table definition is (we have got 45055 records)

 CREATE TABLE `albaranes` (
   `Cli` varchar(6) NOT NULL default '',
   `Alb` varchar(8) NOT NULL default '',
   `Fac` varchar(8) NOT NULL default '',
   `Ped` varchar(8) NOT NULL default '',
   `Pis` char(2) NOT NULL default '',
   `Fec` date default NULL,
   `Dom` char(2) NOT NULL default '',
   `FoP` char(2) NOT NULL default '',
   `Ven` char(3) NOT NULL default '',
   `Rep` char(3) NOT NULL default '',
   `Ba1` decimal(20,4) NOT NULL default '0.',
   `Ba2` decimal(20,4) NOT NULL default '0.',
   `Ba3` decimal(20,4) NOT NULL default '0.',
   `Ba4` decimal(20,4) NOT NULL default '0.',
   `Iv1` float NOT NULL default '0',
   `Iv2` float NOT NULL default '0',
   `Iv3` float NOT NULL default '0',
   `Iv4` float NOT NULL default '0',
   `Re1` float NOT NULL default '0',
   `Re2` float NOT NULL default '0',
   `Re3` float NOT NULL default '0',
   `Re4` float NOT NULL default '0',
   `Dps` decimal(20,4) NOT NULL default '0.',
   `Dpj` double NOT NULL default '0',
   `Por` decimal(20,4) NOT NULL default '0.',
   `TCV` decimal(20,4) NOT NULL default '0.',

Re: optimizer bug in selecting fields that dont belong to the index used by mysql/innodb

2002-09-23 Thread Heikki Tuuri

Rafa,

- Original Message -
From: [EMAIL PROTECTED]
Newsgroups: mailing.database.mysql
Sent: Monday, September 23, 2002 10:54 AM
Subject: optimizer bug in selecting fields that don´t belong to the index
used by mysql/innodb


 Description:
   Hello,

   I wrote the following text in my last message (It was an answer to
Monty):

...

   and I have received no answer, so, Have you received the file
clientes.zip?
   Have you tested it?
   Let me know about it.

I am sorry we have not yet had time to process this. We have prepared the
upcoming MySQL-4.0.4.

   Thanks in advance,
   Rafa

Thank you,

Heikki


 How-To-Repeat:
Select Cod,Nom,Nif,Nombre_comercial from Clientes Where (Nom = 'a2618'
And
Cod'059336') Or Nom'a2618' Order by Nom ASC, Cod ASC Limit 50;

 Fix:
 -

 Synopsis:optimizer bug in selecting fields that don´t belong to the index
used by mysql/innodb

 Submitter-Id:   submitter ID
 Originator: Rafa
 Organization:   Pecomark
 MySQL support:  none
 Severity:   non-critical
 Priority:   medium
 Category:   mysqld-max-nt
 Class:  sw-bug
 Release:mysqld 4.0.3 beta(InnoDB)

 Exectutable:   mysqld-max-nt
 Environment:   Pentium III-MMX, 500 MHZ, 540 MB
 System:Windows 2000
 Compiler:  -
 Architecture:  i

 __
 The NEW Netscape 7.0 browser is now available. Upgrade now!
http://channels.netscape.com/ns/browsers/download.jsp

 Get your own FREE, personal Netscape Mail account today at
http://webmail.netscape.com/

 -
 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




-
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




Re: optimizer bug in selecting fields that dont belong to the index used by mysql/innodb

2002-09-18 Thread Michael Widenius


Hi!

 Heikki == Heikki Tuuri [EMAIL PROTECTED] writes:

Heikki Rafa,
Heikki OR's are generally difficult to optimize.

Heikki, this is true if you are using OR on different keys.
MySQL can fully optimise the query when using OR on different key parts of the
same key (which is the case for the used query:)

Select Cod,Nom,Nif,Nombre_comercial from Clientes Where (Nom = 'GARCIA MANCILLA,S.L' 
And Cod'061642') Or Nom'GARCIA MANCILLA,S.L' Order by Nom ASC, Cod ASC Limit 50;

In this case MySQL should start scanning the table from the key

[(GARCIA MANCILLA),(061642)[

and continue until it has found 50 rows.

Regards,
Monty

-
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