SELECT in NULL state for a long time
Hi, OS - Solaris 10, 32 Gb RAM, mysql 64-bit 4.1.22 Every day I see in processlist many SELECT queries that stay in NULL state for a long time. Something Like this | 368966 | radius | fire-u1:35671 | srg_conf | Query | 106 | NULL |SELECT id, deleted_id, status, name, LEFT( value, 1000 ) FROM s | 368967 | radius | fire-u1-1:35672 | srg_conf | Query | 105 | NULL |SELECT id, deleted_id, status, name, LEFT( value, 1000 ) FROM s | 368968 | radius | fire-u1-1:35673 | srg_conf | Query | 101 | NULL |SELECT id, deleted_id, status, name, LEFT( value, 1000 ) FROM s | 368969 | radius | fire-u1:35674 | srg_conf | Query | 101 | NULL |SELECT id, deleted_id, status, name, LEFT( value, 1000 ) FROM s | 368970 | radius | fire-u1:35675 | srg_conf | Query | 100 | NULL |SELECT id, deleted_id, status, name, LEFT( value, 1000 ) FROM s | 28 | mysql | fire-u1:58138 | hnt_cn | Query | 116 | NULL |SELECT id, deleted_id, status, name, LEFT( value, 1000 ) FROM h | 48 | radius | fire-u1:58166 | hnt_cn | Query | 114 | NULL |SELECT id, deleted_id, status, name, LEFT( value, 1000 ) FROM h | 49 | radius | fire-u1-1:58165 | srg_cn | Query | 127 | NULL |SELECT id, deleted_id, status, name, LEFT( value, 1000 ) FROM s | 50 | mysql | fire-u1-1:58163 | blr_cn | Query | 120 | NULL |SELECT id, deleted_id, status, name, LEFT( value, 1000 ) FROM b Connections grow up during this time and after a couple minutes this problem gonna away. Explain me please why it happens and how can I solve this problem Thanks -- Vlad A. Shalnev E-mail: [EMAIL PROTECTED] "Gravity can't be blamed for someone falling in love" ( Albert Einstein ) -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Problem with symbolic link
Hi all Problem description OS: Solaris 9 Mysql: 4.1.8 I have two configuration database for my application and I need to have some tables with same data and some tables with different data. I solve this problem with symbolic linked tables (for MYI and MYD files). Periodically I get error message "File '../conf/xxx.MYD' not found (Errcode: 2)" for tables that are symbolic link to tables on different configuration database (on the same file system). Error disappears after executing "flush tables". If someone solve this problem let me know please. Thanks for any help -- Vlad A. Shalnev E-mail: [EMAIL PROTECTED] "Gravity can't be blamed for someone falling in love" ( Albert Einstein ) -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Problem with symbolic link
I have two configuration database for my application and I need to have some tables with same data and some tables with different data. Jasper Bryant-Greene wrote: Vlad Shalnev wrote: Periodically I get error message "can't get stat of xxx.MYD" for tables that are symbolic link to tables on different database on the same file system. Error disappear after executing "flush tables". Why are you doing this? You can access tables in other databases in your SQL queries so what is the point of making symbolic links to tables in other databases? Is it even supported? -- Vlad A. Shalnev E-mail: [EMAIL PROTECTED] "Gravity can't be blamed for someone falling in love" ( Albert Einstein ) -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Problem with symbolic link
Hi all Problem description OS: Solaris 9 Mysql: 4.1.8 Periodically I get error message "can't get stat of xxx.MYD" for tables that are symbolic link to tables on different database on the same file system. Error disappear after executing "flush tables". If someone solve this problem let me know please. Thanks for any help -- Vlad A. Shalnev E-mail: [EMAIL PROTECTED] "Gravity can't be blamed for someone falling in love" ( Albert Einstein ) -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: illegal mix of utf8_bin and utf8_general_ci collations
Hi Try this query select * from mysql.db where db = database() collate utf8_bin; Jim Cramer wrote: Hi, With MySql 4.1.10a, I am using a commerial app (Advanced Query Tool) to query and manage the server and databases in it. While performing one of its functions, the app issues the query " select * from msql.db where db=database() This query give the error: "HYT00(1267) Illegal mix of collations (utf8_bin,IMPLICIT) and (utf8_general_ci,IMPLICIT) for operation '=' " This is because the mysql database db table is set to utf8_bin collation but the function "database()" returns a result that is in utf8_general_ci collation, and the comparison of them with the "=" operator is incompatible. Can anybody tell me what to do to make this not happen? How can I set the collation of information functions like database() (in this case to utf_bin to match the mysql.db column)? I have played around with having the client app issue SET of connection_collation, server_collation, and some other system variables. I don't know if this is even the right approach and what to set which variable to. Thanks for any advice you can give, Jim Cramer University of Iowa -- Vlad A. Shalnev E-mail: [EMAIL PROTECTED] "Gravity can't be blamed for someone falling in love" ( Albert Einstein ) -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Comparing bug in 4.1.7
Sergei Golubchik wrote: Hi! On Dec 02, Vlad Shalnev wrote: Looks like a bug. Could you submit a bugreport at http://bugs.mysql.com ? I've submitted a bugreport. Downgrade to 3.23 and wait for this problem solving. Thanks for all It happens after upgrade from 3.23.46. mysql> create table a ( a int not null ); Query OK, 0 rows affected (0.00 sec) mysql> select min( a ) is null or null from a; +--+ | min( a ) is null or null | +--+ | NULL | -> Why ??? +--+ 1 row in set (0.00 sec) It is very important for me to solve this problem. Thanks for any help Regards, Sergei -- Vlad A. Shalnev E-mail: [EMAIL PROTECTED] "Gravity can't be blamed for someone falling in love" ( Albert Einstein ) -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Comparing bug in 4.1.7
Hi This definition (from the manual) is self-contradicting: 1 OR NULL should evaluate to 1 because "any operand is non-zero", but it should also evaluate to NULL because "any operand is NULL". Why self-contradicting ? If you apply this rule as described ( from left to right ) you will get correct result. And it isn't work in 4.1.7 :(( As you see my first query work as described in definition but when i use aggregate function - it doesn't work. Thanks OR || Logical OR. Evaluates to 1 if any operand is non-zero, to NULL if any operand is NULL, otherwise 0 is returned. mysql> SELECT 1 || 1; -> 1 mysql> SELECT 1 || 0; -> 1 mysql> SELECT 0 || 0; -> 0 mysql> SELECT 0 || NULL; -> NULL mysql> SELECT 1 || NULL; -> 1 mysql> select 1 or null; +---+ | 1 or null | +---+ | 1 | -> Ok +---+ 1 row in set (0.00 sec) >> mysql> create table a ( a int not null ); Query OK, 0 rows affected (0.00 sec) mysql> select min( a ) is null from a; +--+ | min( a ) is null | +--+ |1 | -> Ok +--+ 1 row in set (0.00 sec) mysql> select min( a ) is null or null from a; +--+ | min( a ) is null or null | +--+ | NULL | -> Why ??? +--+ 1 row in set (0.00 sec) -- Vlad A. Shalnev E-mail: [EMAIL PROTECTED] "Gravity can't be blamed for someone falling in love" ( Albert Einstein ) -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Comparing bug in 4.1.7
Bernard Clement wrote: Hello Vlad, The reason is: "If one or both arguments are NULL, the result of the comparison is NULL, except for the NULL-safe <=> equality comparison operator. Thereore, "or NULL" in your select statement will always returned NULL. You can find all the rules for comparaison at URL: http://dev.mysql.com/doc/mysql/en/Comparison_Operators.html Thanks for help but this is not my case. My case described in section "Logical Operators": OR || Logical OR. Evaluates to 1 if any operand is non-zero, to NULL if any operand is NULL, otherwise 0 is returned. mysql> SELECT 1 || 1; -> 1 mysql> SELECT 1 || 0; -> 1 mysql> SELECT 0 || 0; -> 0 mysql> SELECT 0 || NULL; -> NULL mysql> SELECT 1 || NULL; -> 1 Any help appreciated. Hi, All It's happen after upgrade from 3.23.46. Just look at this set of queries mysql> select 1 or null; +---+ | 1 or null | +---+ | 1 | -> Ok +---+ 1 row in set (0.00 sec) mysql> create table a ( a int not null ); Query OK, 0 rows affected (0.00 sec) mysql> select min( a ) is null from a; +--+ | min( a ) is null | +--+ |1 | -> Ok +--+ 1 row in set (0.00 sec) mysql> select min( a ) is null or null from a; +--+ | min( a ) is null or null | +--+ | NULL | -> Why ??? +--+ 1 row in set (0.00 sec) It is very important for me to solve this problem. Thanks for any help Info from mysqlbug script Server version 4.1.7 Protocol version10 Connection Localhost via UNIX socket UNIX socket /tmp/.mysql.sock Uptime: 23 hours 43 min 34 sec Threads: 2 Questions: 53 Slow queries: 0 Opens: 20 Flush tables: 1 Open tables: 6 Queries per second avg: 0.001 C compiler:2.95.3 C++ compiler: 2.95.3 >Environment: System: SunOS asv 5.8 Generic_108529-23 i86pc i386 i86pc Architecture: i86pc Some paths: /usr/local/bin/perl /usr/ccs/bin/make /opt/sfw/bin/gmake /opt/sfw/bin/gcc /usr/local/bin/cc GCC: Reading specs from /opt/sfw/lib/gcc-lib/i386-pc-solaris2.8/2.95.3/specs gcc version 2.95.3 20010315 (release) Compilation info: CC='gcc' CFLAGS='' CXX='g++' CXXFLAGS='' LDFLAGS='' ASFLAGS='' LIBC: -rw-r--r-- 1 root bin 1608268 Jul 30 2003 /lib/libc.a lrwxrwxrwx 1 root root 11 Mar 3 2004 /lib/libc.so -> ./libc.so.1 -rwxr-xr-x 1 root bin 956112 Jul 30 2003 /lib/libc.so.1 -rw-r--r-- 1 root bin 1608268 Jul 30 2003 /usr/lib/libc.a lrwxrwxrwx 1 root root 11 Mar 3 2004 /usr/lib/libc.so -> ./libc.so.1 -rwxr-xr-x 1 root bin 956112 Jul 30 2003 /usr/lib/libc.so.1 Configure command: ./configure '--prefix=/usr/local/mysql-4.1.7' '--exec-prefix=/usr/local/mysql-4.1.7' '--libexecdir=/usr/local/mysql-4.1.7/bin' '--localstatedir=/main/MysqlDB' '--enable-thread-safe-client' '--with-unix-socket-path=/tmp/.mysql.sock' '--with-mysqld-user=mysql' '--without-debug' '--without-bench' '--with-charset=koi8r' Perl: This is perl, version 5.005_03 built for i86pc-solaris -- --- - Vlad A. Shalnev E-mail: [EMAIL PROTECTED] "Gravity can't be blamed for someone falling in love" ( Albert Einstein ) -- Vlad A. Shalnev E-mail: [EMAIL PROTECTED] "Gravity can't be blamed for someone falling in love" ( Albert Einstein ) -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Comparing bug in 4.1.7
Hi, All It's happen after upgrade from 3.23.46. Just look at this set of queries mysql> select 1 or null; +---+ | 1 or null | +---+ | 1 | -> Ok +---+ 1 row in set (0.00 sec) mysql> create table a ( a int not null ); Query OK, 0 rows affected (0.00 sec) mysql> select min( a ) is null from a; +--+ | min( a ) is null | +--+ |1 | -> Ok +--+ 1 row in set (0.00 sec) mysql> select min( a ) is null or null from a; +--+ | min( a ) is null or null | +--+ | NULL | -> Why ??? +--+ 1 row in set (0.00 sec) It is very important for me to solve this problem. Thanks for any help Info from mysqlbug script Server version 4.1.7 Protocol version10 Connection Localhost via UNIX socket UNIX socket /tmp/.mysql.sock Uptime: 23 hours 43 min 34 sec Threads: 2 Questions: 53 Slow queries: 0 Opens: 20 Flush tables: 1 Open tables: 6 Queries per second avg: 0.001 C compiler:2.95.3 C++ compiler: 2.95.3 >Environment: System: SunOS asv 5.8 Generic_108529-23 i86pc i386 i86pc Architecture: i86pc Some paths: /usr/local/bin/perl /usr/ccs/bin/make /opt/sfw/bin/gmake /opt/sfw/bin/gcc /usr/local/bin/cc GCC: Reading specs from /opt/sfw/lib/gcc-lib/i386-pc-solaris2.8/2.95.3/specs gcc version 2.95.3 20010315 (release) Compilation info: CC='gcc' CFLAGS='' CXX='g++' CXXFLAGS='' LDFLAGS='' ASFLAGS='' LIBC: -rw-r--r-- 1 root bin 1608268 Jul 30 2003 /lib/libc.a lrwxrwxrwx 1 root root 11 Mar 3 2004 /lib/libc.so -> ./libc.so.1 -rwxr-xr-x 1 root bin 956112 Jul 30 2003 /lib/libc.so.1 -rw-r--r-- 1 root bin 1608268 Jul 30 2003 /usr/lib/libc.a lrwxrwxrwx 1 root root 11 Mar 3 2004 /usr/lib/libc.so -> ./libc.so.1 -rwxr-xr-x 1 root bin 956112 Jul 30 2003 /usr/lib/libc.so.1 Configure command: ./configure '--prefix=/usr/local/mysql-4.1.7' '--exec-prefix=/usr/local/mysql-4.1.7' '--libexecdir=/usr/local/mysql-4.1.7/bin' '--localstatedir=/main/MysqlDB' '--enable-thread-safe-client' '--with-unix-socket-path=/tmp/.mysql.sock' '--with-mysqld-user=mysql' '--without-debug' '--without-bench' '--with-charset=koi8r' Perl: This is perl, version 5.005_03 built for i86pc-solaris -- Vlad A. Shalnev E-mail: [EMAIL PROTECTED] "Gravity can't be blamed for someone falling in love" ( Albert Einstein ) -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Compiling 4.0.20 bug on Solaris 8 x86 ( gcc version 2.95.3 20010315 (release) )
Hi Configure run command: ./configure \ --prefix=${INSTALL_DIRECTORY} \ --exec-prefix=${INSTALL_DIRECTORY} \ --libexecdir=${INSTALL_DIRECTORY}/bin \ --disable-shared \ --enable-thread-safe-client \ --enable-local-infile \ --with-unix-socket-path=/tmp/.mysql.sock \ --with-mysqld-user=${INSTALL_USER} \ --with-openssl \ --with-openssl-includes=/opt/csw/include \ --with-openssl-libs=/opt/csw/lib \ --without-bench \ --with-charset=koi8_ru Bug: gcc can't find openssl includes, although I set --with-openssl-includes gcc -DHAVE_CONFIG_H -I. -I. -I.. -I./../include -I../include-g -O -DDBUG_ON -DSAFE_MUTEX -D_FILE_OFFSET_BITS=64 -DHAVE_CURSES_H -I/tmp/mysql-4.0.20/include -DHAVE_RWLOCK_T -c `test -f 'strxmov.c' || echo './'`strxmov.c In file included from strxmov.c:33: ../include/my_global.h:1129: openssl/opensslv.h: No such file or directory Workaround: Set absolute path in my_global.h and violite.h my_global.h, 1129 #include -> violite.h, 82, 83 #include -> #include -> Please, correct this bug in next release With best regards Vlad A. Shalnev E-mail: [EMAIL PROTECTED] "Gravity can't be blamed for someone falling in love" ( Albert Einstein ) -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Two mysql servers on the same database directory
>From: gerald_clark <[EMAIL PROTECTED]> >User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.1) Gecko/20020823 Netscape/7.0 >To: Vlad Shalnev <[EMAIL PROTECTED]> >Cc: [EMAIL PROTECTED] >Subject: Re: Two mysql servers on the same database directory > > > >Vlad Shalnev wrote: > >>Hi, All >> >>Can two mysql servers work on the same database directory ? It it possible in >>read only mode or in read and write mode ? >> >>With best regards >> >> >> >Yes, if you don't disable file locking. >Why would you do this though? >Each server will have to lock the files, blocking the other server. > > Thanks Sun cluster system. Two independent nodes work on the same disk array. That is why two mysql servers have to work on the same database directory. Vlad A. Shalnev E-mail: [EMAIL PROTECTED] "Gravity can't be blamed for someone falling in love" ( Albert Einstein ) - 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
Two mysql servers on the same database directory
Hi, All Can two mysql servers work on the same database directory ? It it possible in read only mode or in read and write mode ? With best regards Vlad A. Shalnev E-mail: [EMAIL PROTECTED] "Gravity can't be blamed for someone falling in love" ( Albert Einstein ) - 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
Cardinality and index using
Hi, all I am using mysql - 3.23.46, Intel, Solaris 8 Some questions: 1) Why cardinality value don't automaticly change when query change set of unique values in index ( insert or update ) ? Example: mysql> create table a ( a int not null, index ( a ) ); Query OK, 0 rows affected (0.02 sec) mysql> show index from a; +---++--+--+-+---+-- ---+--++-+ | Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Comment | +---++--+--+-+---+-- ---+--++-+ | a | 1 | a|1 | a | A | NULL | NULL | NULL | | +---++--+--+-+---+-- ---+--++-+ 1 row in set (0.00 sec) mysql> insert into a values ( 1 ); Query OK, 1 row affected (0.00 sec) mysql> show index from a; +---++--+--+-+---+-- ---+--++-+ | Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Comment | +---++--+--+-+---+-- ---+--++-+ | a | 1 | a|1 | a | A | NULL -??? | NULL | NULL | | +---++--+--+-+---+-- ---+--++-+ 1 row in set (0.00 sec) mysql> optimize table a; +---+--+--+--+ | Table | Op | Msg_type | Msg_text | +---+--+--+--+ | tmp.a | optimize | status | OK | +---+--+--+--+ 1 row in set (0.04 sec) mysql> show index from a; +---++--+--+-+---+-- ---+--++-+ | Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Comment | +---++--+--+-+---+-- ---+--++-+ | a | 1 | a|1 | a | A | 1 | NULL | NULL | | +---++--+--+-+---+-- ---+--++-+ 1 row in set (0.00 sec) 2) Why index using in different way when cardinality = 1 and cardinality > 1 ? Example: index in calculated_offlc ( contract_id ) have cardinality = 1 mysql> show index from contract; +--+++--+-+---+- +--++-+ | Table| Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Comment | +--+++--+-+---+- +--++-+ | contract | 0 | PRIMARY|1 | id | A | 8520 | NULL | NULL | | | contract | 0 | deleted_id |1 | deleted_id | A | NULL | NULL | NULL | | | contract | 0 | deleted_id |2 | number | A | 8520 | NULL | NULL | | +--+++--+-+---+- +--++-+ 3 rows in set (0.00 sec) mysql> show index from calculated_offlc; +--++-+--+-- -+---+-+--++-+ | Table| Non_unique | Key_name| Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Comment | +--++-+--+-- -+---+-+--++-+ | calculated_offlc | 0 | PRIMARY |1 | processed_data_id | A | 46706 | NULL | NULL | | | calculated_offlc | 1 | contract_id |1 | contract_id | A | 1 - !!! | NULL | NULL | | +--++-+--+-- -+---+-+--++-+ 2 rows in set (0.00 sec) mysql> explain SELECT c.id, IFNULL( SUM( c_offlc.value ), 0 ) FROM contract AS c LEFT JOIN calculated_offlc AS c_offlc ON c_offlc.contract_id = c.id GROUP BY c.id; +-+---+---+-+-+--+---+-- + | table | type | possible_keys | key | key_len | ref | rows | Extra | +-+---+--
Cardinality and index using
Hi, all I am using mysql - 3.23.46, Intel, Solaris 8 Some questions: 1) Why cardinality value don't automaticly change when query change set of unique values in index ( insert or update ) ? Example: mysql> create table a ( a int not null, index ( a ) ); Query OK, 0 rows affected (0.02 sec) mysql> show index from a; +---++--+--+-+---+-- ---+--++-+ | Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Comment | +---++--+--+-+---+-- ---+--++-+ | a | 1 | a|1 | a | A | NULL | NULL | NULL | | +---++--+--+-+---+-- ---+--++-+ 1 row in set (0.00 sec) mysql> insert into a values ( 1 ); Query OK, 1 row affected (0.00 sec) mysql> show index from a; +---++--+--+-+---+-- ---+--++-+ | Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Comment | +---++--+--+-+---+-- ---+--++-+ | a | 1 | a|1 | a | A | NULL -??? | NULL | NULL | | +---++--+--+-+---+-- ---+--++-+ 1 row in set (0.00 sec) mysql> optimize table a; +---+--+--+--+ | Table | Op | Msg_type | Msg_text | +---+--+--+--+ | tmp.a | optimize | status | OK | +---+--+--+--+ 1 row in set (0.04 sec) mysql> show index from a; +---++--+--+-+---+-- ---+--++-+ | Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Comment | +---++--+--+-+---+-- ---+--++-+ | a | 1 | a|1 | a | A | 1 | NULL | NULL | | +---++--+--+-+---+-- ---+--++-+ 1 row in set (0.00 sec) 2) Why index using in different way when cardinality = 1 and cardinality > 1 ? Example: index in calculated_offlc ( contract_id ) have cardinality = 1 mysql> show index from contract; +--+++--+-+---+- +--++-+ | Table| Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Comment | +--+++--+-+---+- +--++-+ | contract | 0 | PRIMARY|1 | id | A | 8520 | NULL | NULL | | | contract | 0 | deleted_id |1 | deleted_id | A | NULL | NULL | NULL | | | contract | 0 | deleted_id |2 | number | A | 8520 | NULL | NULL | | +--+++--+-+---+- +--++-+ 3 rows in set (0.00 sec) mysql> show index from calculated_offlc; +--++-+--+-- -+---+-+--++-+ | Table| Non_unique | Key_name| Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Comment | +--++-+--+-- -+---+-+--++-+ | calculated_offlc | 0 | PRIMARY |1 | processed_data_id | A | 46706 | NULL | NULL | | | calculated_offlc | 1 | contract_id |1 | contract_id | A | 1 - !!! | NULL | NULL | | +--++-+--+-- -+---+-+--++-+ 2 rows in set (0.00 sec) mysql> explain SELECT c.id, IFNULL( SUM( c_offlc.value ), 0 ) FROM contract AS c LEFT JOIN calculated_offlc AS c_offlc ON c_offlc.contract_id = c.id GROUP BY c.id; +-+---+---+-+-+--+---+-- + | table | type | possible_keys | key | key_len | ref | rows | Extra | +-+---+--