Quantcast
Channel: Teradata Forums - Database
Viewing all articles
Browse latest Browse all 14773

Table Partition - response (4) by sharatbalaji

$
0
0

Hi,
-- CASE 1
CREATE SET TABLE INFORM_USER.TABLEA ,NO FALLBACK ,
NO BEFORE JOURNAL,
NO AFTER JOURNAL,
CHECKSUM = DEFAULT,
DEFAULT MERGEBLOCKRATIO
(
PLCY_NBR INTEGER,
MO_ID INTEGER,
PLCY_STATUS VARCHAR(20) CHARACTER SET LATIN NOT CASESPECIFIC
)
PRIMARY INDEX ( PLCY_NBR,MO_ID )
PARTITION BY RANGE_N(CAST(((CAST((MO_ID ) AS VARCHAR(10) CHARACTER SET LATIN NOT CASESPECIFIC))||'01') AS DATE FORMAT 'YYYYMMDD') BETWEEN DATE '2010-01-01' AND DATE '2090-12-01' EACH INTERVAL '1' MONTH);
INSERT INTO INFORM_USER.TABLEA VALUES (123,201201,'INFORCE');
INSERT INTO INFORM_USER.TABLEA VALUES (456,201202,'CANCEL');
Explain SEL * FROM INFORM_USER.TABLEA WHERE MO_ID IN (201201,201202);
1) First, we lock a distinct INFORM_USER."pseudo table" for read on a
RowHash to prevent global deadlock for INFORM_USER.TABLEA.
2) Next, we lock INFORM_USER.TABLEA for read.
3) We do an all-AMPs RETRIEVE step from INFORM_USER.TABLEA by way of
an all-rows scan with a condition of ("(INFORM_USER.TABLEA.MO_ID =
201202) OR (INFORM_USER.TABLEA.MO_ID = 201201)") into Spool 1
(group_amps), which is built locally on the AMPs. The size of
Spool 1 is estimated with no confidence to be 6 rows (222 bytes).
The estimated time for this step is 0.02 seconds.
4) Finally, we send out an END TRANSACTION step to all AMPs involved
in processing the request.
-> The contents of Spool 1 are sent back to the user as the result of
statement 1. The total estimated time is 0.02 seconds.
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- CASE 2
CREATE SET TABLE INFORM_USER.TABLEB ,NO FALLBACK ,
NO BEFORE JOURNAL,
NO AFTER JOURNAL,
CHECKSUM = DEFAULT,
DEFAULT MERGEBLOCKRATIO
(
PLCY_NBR INTEGER,
MO_ID INTEGER,
PLCY_STATUS VARCHAR(20) CHARACTER SET LATIN NOT CASESPECIFIC
)
PRIMARY INDEX ( PLCY_NBR,MO_ID )
PARTITION BY RANGE_N(MO_ID BETWEEN 201001 AND 209012 EACH 1);
INSERT INTO INFORM_USER.TABLEB VALUES (123,201201,'INFORCE');
INSERT INTO INFORM_USER.TABLEB VALUES (456,201202,'CANCEL');
Explain SEL * FROM INFORM_USER.TABLEB WHERE MO_ID IN (201201,201202);
1) First, we lock a distinct INFORM_USER."pseudo table" for read on a
RowHash to prevent global deadlock for INFORM_USER.TABLEB.
2) Next, we lock INFORM_USER.TABLEB for read.
3) We do an all-AMPs RETRIEVE step from 2 partitions of
INFORM_USER.TABLEB with a condition of (
"(INFORM_USER.TABLEB.MO_ID = 201202) OR (INFORM_USER.TABLEB.MO_ID
= 201201)") into Spool 1 (group_amps), which is built locally on
the AMPs. The size of Spool 1 is estimated with no confidence to
be 6 rows (222 bytes). The estimated time for this step is 0.02
seconds.
4) Finally, we send out an END TRANSACTION step to all AMPs involved
in processing the request.
-> The contents of Spool 1 are sent back to the user as the result of
statement 1. The total estimated time is 0.02 seconds.
My Question is the way partition is defined is different in two cases. Why does first case does a all rows scan and second case looks in to the 2 partitions alone?
@Raja K Thaw - I am not able to get what you are trying to say.
@khurram - Ok lets agree that it does full table scan when we use 'IN' clause. In my case 2 i used the same 'IN' clause but it doesnt do full table scan and looks in to 2 partitions only. Why is it so?
@dieter - The data has been inserted and still getting the same issue
 
Thanks,
Sharat Balaji
Dieter
 
 


Viewing all articles
Browse latest Browse all 14773

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>