Description:
mysql> select * from consolidation where id_cr=2733 and date_start >= '2014-05-01 00:00:00.0' and date_start <= '2014-05-01 00:00:05' and id_product=21;
Empty set (0.00 sec)
mysql> select * from consolidation where id_cr=2733 and date_start >= '2014-05-01 00:00:00.0' and date_start <= '2014-05-01 00:00:05' and id_product>=21;
Empty set (0.00 sec)
mysql> select * from consolidation where id_cr=2733 and date_start >= '2014-05-01 00:00:00.0' and date_start <= '2014-05-01 00:00:05' and id_product>20;
+--------+-------+------------+---------------------+---------------------+-----------+----------+-----------+
| id | id_cr | id_product | date_start | date_end | cons | charged | total |
+--------+-------+------------+---------------------+---------------------+-----------+----------+-----------+
| 660712 | 2733 | 21 | 2014-05-01 00:00:00 | 2014-05-01 01:00:00 | 2.100000 | 3.000000 | 15.000000 |
+--------+-------+------------+---------------------+---------------------+-----------+----------+-----------+
1 row in set (0.00 sec)
mysql> select * from consolidation where id_cr=2733 and date_start >= '2014-05-01 00:00:00' and date_start <= '2014-05-01 00:00:05' and id_product=21;
+--------+-------+------------+---------------------+---------------------+-----------+----------+-----------+
| id | id_cr | id_product | date_start | date_end | cons | charged | total |
+--------+-------+------------+---------------------+---------------------+-----------+----------+-----------+
| 660712 | 2733 | 21 | 2014-05-01 00:00:00 | 2014-05-01 01:00:00 | 2.100000 | 3.000000 | 15.000000 |
+--------+-------+------------+---------------------+---------------------+-----------+----------+-----------+
1 row in set (0.00 sec)
mysql> select * from consolidation where id_cr=2733 and date_start >= '2014-05-01 00:00:00' and date_start <= '2014-05-01 00:00:05' and id_product>=21;
+--------+-------+------------+---------------------+---------------------+-----------+----------+-----------+
| id | id_cr | id_product | date_start | date_end | cons | charged | total |
+--------+-------+------------+---------------------+---------------------+-----------+----------+-----------+
| 660712 | 2733 | 21 | 2014-05-01 00:00:00 | 2014-05-01 01:00:00 | 2.100000 | 3.000000 | 15.000000 |
+--------+-------+------------+---------------------+---------------------+-----------+----------+-----------+
1 row in set (0.01 sec)
mysql> select * from consolidation where id_cr=2733 and date_start >= '2014-05-01 00:00:00' and date_start <= '2014-05-01 00:00:05' and id_product>20;
+--------+-------+------------+---------------------+---------------------+-----------+----------+-----------+
| id | id_cr | id_product | date_start | date_end | cons | charged | total |
+--------+-------+------------+---------------------+---------------------+-----------+----------+-----------+
| 660712 | 2733 | 21 | 2014-05-01 00:00:00 | 2014-05-01 01:00:00 | 2.100000 | 3.000000 | 15.000000 |
+--------+-------+------------+---------------------+---------------------+-----------+----------+-----------+
1 row in set (0.02 sec)
mysql> describe consolidation;
+------------+---------------+------+-----+---------------------+----------------+
| Field | Type | Null | Key | Default | Extra |
+------------+---------------+------+-----+---------------------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| id_cr | int(11) | NO | MUL | NULL | |
| id_product | int(11) | NO | MUL | NULL | |
| date_start | timestamp | NO | | 1971-01-01 03:00:00 | |
| date_end | timestamp | YES | | NULL | |
| cons | decimal(18,6) | NO | | NULL | |
| charged | decimal(18,6) | NO | | NULL | |
| total | decimal(18,6) | YES | | NULL | |
+------------+---------------+------+-----+---------------------+----------------+
How to repeat:
Unfortunatelly I couldn't produce a self-contained-example. Hopefully the provided info can help.
Suggested fix:
I'd bet this problem is related to index.