MySQL Forums
Forum List  »  Partitioning

wrong output generate while using partitions
Posted by: Shivam Patel
Date: December 13, 2014 07:56AM

Dear,
I am using partition concept in my one table as per given below. When i am execute query as per given below, queries output comes vary in case of table with partition and table with partition.

Output must come 1,2,3,4,5 as per sample insert queries given below but it is coming 1,5 when executing query on table with partition. Without using partition, output is coming proper.
Actual table consist 30 lacs data.

Kindly guide me what is problem with partition due to which it is generating wrong output. If any information still require then please revert.

Structure
=========

TABLE
=====
CREATE TABLE TABLE1 (
column1 int(6) NOT NULL,
column2 int(3) DEFAULT NULL,
column3 varchar(6) DEFAULT NULL,
column4 decimal(12,2) NOT NULL,
KEY TABLE1.column1 (column1),
KEY TABLE1.column2 (column2),
KEY TABLE1.column3 (column3),
KEY TABLE1.column4 (column4)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=latin1
PARTITION BY RANGE (column1)
(PARTITION P1 VALUES LESS THAN (1) ENGINE = InnoDB,
PARTITION P2 VALUES LESS THAN (2) ENGINE = InnoDB,
PARTITION P3 VALUES LESS THAN (3) ENGINE = InnoDB,
PARTITION P5 VALUES LESS THAN (5) ENGINE = InnoDB,
PARTITION P7 VALUES LESS THAN (7) ENGINE = InnoDB,
PARTITION P10 VALUES LESS THAN (10) ENGINE = InnoDB,
PARTITION P11 VALUES LESS THAN (11) ENGINE = InnoDB,
PARTITION P12 VALUES LESS THAN (12) ENGINE = InnoDB,
PARTITION P13 VALUES LESS THAN (13) ENGINE = InnoDB,
PARTITION P17 VALUES LESS THAN (17) ENGINE = InnoDB,
PARTITION P19 VALUES LESS THAN (19) ENGINE = InnoDB,
PARTITION P20 VALUES LESS THAN (20) ENGINE = InnoDB,
PARTITION P21 VALUES LESS THAN (21) ENGINE = InnoDB,
PARTITION P22 VALUES LESS THAN (22) ENGINE = InnoDB,
PARTITION P23 VALUES LESS THAN (23) ENGINE = InnoDB,
PARTITION P24 VALUES LESS THAN (24) ENGINE = InnoDB,
PARTITION P25 VALUES LESS THAN (25) ENGINE = InnoDB,
PARTITION P26 VALUES LESS THAN (26) ENGINE = InnoDB,
PARTITION P27 VALUES LESS THAN (27) ENGINE = InnoDB,
PARTITION P28 VALUES LESS THAN (28) ENGINE = InnoDB,
PARTITION P29 VALUES LESS THAN (29) ENGINE = InnoDB,
PARTITION P30 VALUES LESS THAN MAXVALUE ENGINE = InnoDB);

Insert
=======
INSERT INTO TABLE1 VALUES (1,1,'N0090',12.2);
INSERT INTO TABLE1 VALUES (1,6,'N0090',12.2);
INSERT INTO TABLE1 VALUES (2,6,'N0090',12.2);
INSERT INTO TABLE1 VALUES (3,6,'N0090',12.2);
INSERT INTO TABLE1 VALUES (4,6,'N0090',12.2);
INSERT INTO TABLE1 VALUES (5,6,'N0090',12.2);

Query
=====
select DISTINCT column1
from table1
where column2 = 6 and column3 = 'N0090'

Exection plan with partition
=============================

# id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE TABLE1 index_merge TABLE1_COLUMN1,TABLE1_COLUMN3,TABLE1_COLUMN2 TABLE1_COLUMN3,TABLE1_COLUMN2 9,4 NULL 370 Using intersect(TABLE1_COLUMN3 ,TABLE1_COLUMN2); Using where; Using temporary

Execution plan without partition
================================
# id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE TABLE1 index_merge TABLE1_COLUMN3,TABLE1_COLUMN2 TABLE1_COLUMN3,TABLE1_COLUMN2 9,4 NULL 664 Using intersect(TABLE1_COLUMN3 ,TABLE1_COLUMN2); Using where; Using temporary

Options: ReplyQuote


Subject
Views
Written By
Posted
wrong output generate while using partitions
2000
December 13, 2014 07:56AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.