MySQL Forums
Forum List  »  Newbie

Re: Very long query doubt... (Monster query...)
Posted by: Toni Lopez
Date: March 30, 2009 08:55AM

Hi again!

First of all, thanks for your time, and of course for your answer!

Sorry if the first query wasn't easily readable.

Ok here I go with the information from my table (now named prepara_sales_mix):

Note: The data values are correct, in the examples below, wont be reals, try to imagine one year. Maybe the worst case, will be, comparing 2 years, 2008-02-01 between and 2009-02-01 and compared with past year, and the other pair will be 6 months compared with past 6 months.

-------------------------
Status:

Name  	 Engine  	 Version  	 Row_format  	 Rows 
prepara_sales_mix  	MyISAM  	9  	Dynamic  	7225939

Avg_row_length  	 Data_length  	 Max_data_lengt
36  	261359172  	4294967295  	

Index_length  	 Data_free  	 Auto_increment 
69030912  	0  	NULL	 

The other cols from status command wont be useful,don't you think so?


-----------------

Describe table results:
Field
	
Type
	
Null
	
Key
	
Default
	
Extra
fecha 	date 	  	MUL 	0000-00-00 	 
cod_articulo 	varchar(40) 	  	  	  	 
cod_oper 	varchar(6) 	  	  	  	 
cod_serie 	int(5) 	  	  	0 	 
clase 	char(1) 	  	MUL 	  	 
cantidad 	float(11,2) 	YES 	  	0.00 	 
precio 	float(11,2) 	YES 	  	0.00 	 
dto 	float(11,2) 	YES 	  	0.00 	 



Index Information:
Name  	Type  	Cardinality    	Campo
fecha 	INDEX 	699  	 	fecha
cod_art INDEX 	7022  	clase cod_articulo


-----------------

Explain results:

I wil put some of them, so you can see one sample for each type, talking always about sizes...


-Smallest:

select sum(cantidad),sum(precio),sum(dto * precio) from prepara_sales_mix where fecha >= '2008-09-01' and fecha <= '2008-09-30' and cod_serie in (2, 7, 14, 17, 22, 28, 35, 44, 48, 58, 62, 65, 70, 71, 73, 84, 87, 91, 95, 96, 115, 121, 124, 130, 137, 138, 139, 142, 143, 144, 145, 146, 147, 149, 150, 153, 154, 156, 157, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 174, 175, 177, 179, 180, 182, 183, 184, 186, 187, 188, 189, 190, 191, 192, 195, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 210, 212, 213, 214, 216, 218, 219, 220, 222, 223, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 236, 237, 238, 239, 240, 241, 243, 244, 245, 246, 247, 248, 249, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 266, 267, 268, 271, 273, 274, 276, 277, 279, 280, 281, 282, 284, 285, 289, 290, 292, 294, 295, 299, 300, 301, 302, 303, 304, 306, 307, 308, 309, 311, 312, 313, 314, 315, 316, 317, 318, 319, 321, 322, 324, 325, 326, 327, 328, 330, 332, 333, 334, 335, 336, 337, 338, 340, 341, 342, 343, 344, 345, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 361, 362, 363, 364, 365, 366, 367, 368, 369, 897, 899) and ( (cod_articulo = 'TL102' and clase = 'C') or (cod_articulo = 'TL102' and clase = 'N') or (cod_articulo = 'TL106' and clase = 'N') or (cod_articulo = 'TM000' and clase = 'C') or (cod_articulo = 'TM000' and clase = 'N') or (cod_articulo = 'TM01' and clase = 'C') or (cod_articulo = 'TM01' and clase = 'N') or (cod_articulo = 'TM210' and clase = 'C') or (cod_articulo = 'TM210' and clase = 'N') or (cod_articulo = 'TST11' and clase = 'C') or (cod_articulo = 'TST11' and clase = 'H') or (cod_articulo = 'TST11' and clase = 'N') or (cod_articulo = 'TST11B' and clase = 'C') or (cod_articulo = 'TST11B' and clase = 'N') or (cod_articulo = 'TST11B' and clase = 'S') or (cod_articulo = 'TST11BL' and clase = 'C') or (cod_articulo = 'TST11BL' and clase = 'N') or (cod_articulo = 'TST12SL' and clase = 'C') or (cod_articulo = 'TST12SL' and clase = 'N') or (cod_articulo = 'TST13BL' and clase = 'C') or (cod_articulo = 'TST13BL' and clase = 'N') or (cod_articulo = 'TST15' and clase = 'C') or (cod_articulo = 'TST15' and clase = 'M') or (cod_articulo = 'TST15' and clase = 'N') or (cod_articulo = 'TST15' and clase = 'S') or (cod_articulo = 'TST15B' and clase = 'C') or (cod_articulo = 'TST15B' and clase = 'N') or (cod_articulo = 'TST15BL' and clase = 'C') or (cod_articulo = 'TST15BL' and clase = 'N') or (cod_articulo = 'TST18BSL' and clase = 'C') or (cod_articulo = 'TST18BSL' and clase = 'N') or (cod_articulo = 'TST18SL' and clase = 'C') or (cod_articulo = 'TST18SL' and clase = 'M') or (cod_articulo = 'TST18SL' and clase = 'N') or (cod_articulo = 'TST9B' and clase = 'N') or (cod_articulo = 'TB503' and clase = 'C') or (cod_articulo = 'TB503' and clase = 'N') or (cod_articulo = 'TTMACLA' and clase = 'C') or (cod_articulo = 'TTMACLA' and clase = 'N') )

id  	 select_type  	 table  	 type  	 possible_keys  	 key  	 key_len  	 ref  	 rows  	 Extra
1 	SIMPLE 	prepara_sales_mix 	range 	fecha 	fecha 	3 	NULL 	317504 	Using where

(No use of index ... why?)

-------------

- Medium one:

select sum(cantidad),sum(precio),sum(dto * precio) from prepara_sales_mix where fecha >= '2008-09-01' and fecha <= '2008-09-30' and cod_serie in (2, 7, 14, 17, 22, 28, 35, 44, 48, 58, 62, 65, 70, 71, 73, 84, 87, 91, 95, 96, 115, 121, 124, 130, 137, 138, 139, 142, 143, 144, 145, 146, 147, 149, 150, 153, 154, 156, 157, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 174, 175, 177, 179, 180, 182, 183, 184, 186, 187, 188, 189, 190, 191, 192, 195, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 210, 212, 213, 214, 216, 218, 219, 220, 222, 223, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 236, 237, 238, 239, 240, 241, 243, 244, 245, 246, 247, 248, 249, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 266, 267, 268, 271, 273, 274, 276, 277, 279, 280, 281, 282, 284, 285, 289, 290, 292, 294, 295, 299, 300, 301, 302, 303, 304, 306, 307, 308, 309, 311, 312, 313, 314, 315, 316, 317, 318, 319, 321, 322, 324, 325, 326, 327, 328, 330, 332, 333, 334, 335, 336, 337, 338, 340, 341, 342, 343, 344, 345, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 361, 362, 363, 364, 365, 366, 367, 368, 369, 897, 899) and ( (cod_articulo = 'CRNA' and clase = 'N') or (cod_articulo = 'CRNI' and clase = 'N') or (cod_articulo = 'CRNMA' and clase = 'N') or (cod_articulo = 'CRNMA' and clase = 'S') or (cod_articulo = 'CRNN' and clase = 'N') or (cod_articulo = 'TT1' and clase = 'C') or (cod_articulo = 'TT1' and clase = 'N') or (cod_articulo = 'TT10' and clase = 'N') or (cod_articulo = 'TT11' and clase = 'N') or (cod_articulo = 'TT12' and clase = 'N') or (cod_articulo = 'TT13' and clase = 'N') or (cod_articulo = 'TT14' and clase = 'N') or (cod_articulo = 'TT15' and clase = 'N') or (cod_articulo = 'TT16' and clase = 'N') or (cod_articulo = 'TT17' and clase = 'N') or (cod_articulo = 'TT18' and clase = 'N') or (cod_articulo = 'TT19' and clase = 'N') or (cod_articulo = 'TT2' and clase = 'N') or (cod_articulo = 'TT20' and clase = 'N') or (cod_articulo = 'TT21' and clase = 'N') or (cod_articulo = 'TT22' and clase = 'N') or (cod_articulo = 'TT23' and clase = 'N') or (cod_articulo = 'TT24' and clase = 'N') or (cod_articulo = 'TT25' and clase = 'N') or (cod_articulo = 'TT26' and clase = 'N') or (cod_articulo = 'TT27' and clase = 'N') or (cod_articulo = 'TT28' and clase = 'N') or (cod_articulo = 'TT29' and clase = 'N') or (cod_articulo = 'TT3' and clase = 'N') or (cod_articulo = 'TT30' and clase = 'N') or (cod_articulo = 'TT31' and clase = 'N') or (cod_articulo = 'TT32' and clase = 'N') or (cod_articulo = 'TT33' and clase = 'N') or (cod_articulo = 'TT34' and clase = 'N') or (cod_articulo = 'TT35' and clase = 'N') or (cod_articulo = 'TT36' and clase = 'N') or (cod_articulo = 'TT37' and clase = 'N') or (cod_articulo = 'TT38' and clase = 'N') or (cod_articulo = 'TT39' and clase = 'N') or (cod_articulo = 'TT4' and clase = 'N') or (cod_articulo = 'TT40' and clase = 'N') or (cod_articulo = 'TT41' and clase = 'N') or (cod_articulo = 'TT43' and clase = 'N') or (cod_articulo = 'TT44' and clase = 'N') or (cod_articulo = 'TT45' and clase = 'N') or (cod_articulo = 'TT46' and clase = 'N') or (cod_articulo = 'TT47' and clase = 'N') or (cod_articulo = 'TT49' and clase = 'N') or (cod_articulo = 'TT5' and clase = 'N') or (cod_articulo = 'TT50' and clase = 'N') or (cod_articulo = 'TT50' and clase = 'S') or (cod_articulo = 'TT51' and clase = 'N') or (cod_articulo = 'TT51' and clase = 'S') or (cod_articulo = 'TT52' and clase = 'N') or (cod_articulo = 'TT53' and clase = 'N') or (cod_articulo = 'TT54' and clase = 'N') or (cod_articulo = 'TT55' and clase = 'N') or (cod_articulo = 'TT56' and clase = 'N') or (cod_articulo = 'TT6' and clase = 'N') or (cod_articulo = 'TT6' and clase = 'S') or (cod_articulo = 'TT7' and clase = 'N') or (cod_articulo = 'TT8' and clase = 'N') or (cod_articulo = 'TT9' and clase = 'N') or (cod_articulo = 'TT501' and clase = 'N') or (cod_articulo = 'TT502' and clase = 'N') or (cod_articulo = 'TT503' and clase = 'N') or (cod_articulo = 'TT504' and clase = 'N') or (cod_articulo = 'TT505' and clase = 'N') or (cod_articulo = 'TT506' and clase = 'N') or (cod_articulo = 'TT2A' and clase = 'N') or (cod_articulo = 'TT2A' and clase = 'S') or (cod_articulo = 'TT2M' and clase = 'N') or (cod_articulo = 'TT2N' and clase = 'N') or (cod_articulo = 'TT2N' and clase = 'S') or (cod_articulo = 'QC601' and clase = 'N') or (cod_articulo = 'QC601' and clase = 'S') or (cod_articulo = 'QC602' and clase = 'N') or (cod_articulo = 'QC603' and clase = 'N') or (cod_articulo = 'QC603' and clase = 'S') or (cod_articulo = 'QC604' and clase = 'N') or (cod_articulo = 'QC605' and clase = 'N') or (cod_articulo = 'QC605' and clase = 'S') or (cod_articulo = 'QC606' and clase = 'N') or (cod_articulo = 'QC606' and clase = 'S') or (cod_articulo = 'QC607' and clase = 'N') or (cod_articulo = 'QC608' and clase = 'N') or (cod_articulo = 'QC608' and clase = 'S') or (cod_articulo = 'QC609' and clase = 'N') or (cod_articulo = 'QC609' and clase = 'S') or (cod_articulo = 'QC610' and clase = 'N') or (cod_articulo = 'QC610' and clase = 'S') or (cod_articulo = 'QC611' and clase = 'N') or (cod_articulo = 'QC612' and clase = 'N') or (cod_articulo = 'QC612' and clase = 'S') or (cod_articulo = 'QC613' and clase = 'N') or (cod_articulo = 'QC614' and clase = 'N') or (cod_articulo = 'QC614' and clase = 'S') or (cod_articulo = 'QC615' and clase = 'N') or (cod_articulo = 'QC616' and clase = 'N') or (cod_articulo = 'QC617' and clase = 'N') or (cod_articulo = 'QC618' and clase = 'N') or (cod_articulo = 'QC619' and clase = 'N') or (cod_articulo = 'QC620' and clase = 'N') or (cod_articulo = 'QC621' and clase = 'N') or (cod_articulo = 'QC622' and clase = 'N') or (cod_articulo = 'QC623' and clase = 'N') or (cod_articulo = 'QC624' and clase = 'N') or (cod_articulo = 'QC624' and clase = 'S') or (cod_articulo = 'QC625' and clase = 'N') or (cod_articulo = 'QC626' and clase = 'N') or (cod_articulo = 'QC627' and clase = 'N') or (cod_articulo = 'QC628' and clase = 'N') or (cod_articulo = 'QC628' and clase = 'S') or (cod_articulo = 'QC629' and clase = 'N') or (cod_articulo = 'QC630' and clase = 'N') or (cod_articulo = 'QC631' and clase = 'N') or (cod_articulo = 'QC631' and clase = 'S') or (cod_articulo = 'QC632' and clase = 'N') or (cod_articulo = 'QC633' and clase = 'N') or (cod_articulo = 'QC634' and clase = 'N') or (cod_articulo = 'QC635' and clase = 'N') or (cod_articulo = 'QC636' and clase = 'N') or (cod_articulo = 'QC637' and clase = 'N') or (cod_articulo = 'QC638' and clase = 'N') or (cod_articulo = 'QC639' and clase = 'N') or (cod_articulo = 'QC640' and clase = 'N') or (cod_articulo = 'QC640' and clase = 'S') or (cod_articulo = 'QC641' and clase = 'N') or (cod_articulo = 'QC642' and clase = 'N') or (cod_articulo = 'QC643' and clase = 'N') or (cod_articulo = 'QC644' and clase = 'N') or (cod_articulo = 'QC645' and clase = 'N') or (cod_articulo = 'QC645' and clase = 'S') or (cod_articulo = 'QC646' and clase = 'N') or (cod_articulo = 'QC647' and clase = 'N') or (cod_articulo = 'QC648' and clase = 'N') or (cod_articulo = 'QC649' and clase = 'N') or (cod_articulo = 'QC650' and clase = 'N') or (cod_articulo = 'QC651' and clase = 'N') or (cod_articulo = 'QC652' and clase = 'N') or (cod_articulo = 'QC652' and clase = 'S') or (cod_articulo = 'QC653' and clase = 'N') )


Explain results for medium: ...
id  	 select_type  	 table  	 type  	 possible_keys  	 key  	 key_len  	 ref  	 rows  	 Extra
1 	SIMPLE 	prepara_sales_mix 	range 	fecha,cod_art 	cod_art 	123 	NULL 	172578 	Using where

One more without using index...



Biggest one:

select sum(cantidad),sum(precio),sum(dto * precio) from prepara_sales_mix where fecha >= '2008-09-01' and fecha <= '2008-09-30' and cod_serie in (2, 7, 14, 17, 22, 28, 35, 44, 48, 58, 62, 65, 70, 71, 73, 84, 87, 91, 95, 96, 115, 121, 124, 130, 137, 138, 139, 142, 143, 144, 145, 146, 147, 149, 150, 153, 154, 156, 157, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 174, 175, 177, 179, 180, 182, 183, 184, 186, 187, 188, 189, 190, 191, 192, 195, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 210, 212, 213, 214, 216, 218, 219, 220, 222, 223, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 236, 237, 238, 239, 240, 241, 243, 244, 245, 246, 247, 248, 249, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 266, 267, 268, 271, 273, 274, 276, 277, 279, 280, 281, 282, 284, 285, 289, 290, 292, 294, 295, 299, 300, 301, 302, 303, 304, 306, 307, 308, 309, 311, 312, 313, 314, 315, 316, 317, 318, 319, 321, 322, 324, 325, 326, 327, 328, 330, 332, 333, 334, 335, 336, 337, 338, 340, 341, 342, 343, 344, 345, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 361, 362, 363, 364, 365, 366, 367, 368, 369, 897, 899) and ( (cod_articulo = '5L' and clase = 'N') or (cod_articulo = 'AGA24D' and clase = 'N') or (cod_articulo = 'ANK2' and clase = 'N') or (cod_articulo = 'AZ2I-' and clase = 'N') or (cod_articulo = 'BK1I' and clase = 'N') or (cod_articulo = 'BRA1' and clase = 'N') or (cod_articulo = 'BRI2I' and clase = 'N') or (cod_articulo = 'BUR20D' and clase = 'N') or (cod_articulo = 'COR10' and clase = 'N') or (cod_articulo = 'COR21D' and clase = 'N') or (cod_articulo = 'FAC6D' and clase = 'N') or (cod_articulo = 'GAB1I' and clase = 'N') or (cod_articulo = 'JIS3I' and clase = 'N') or (cod_articulo = 'JL2RS' and clase = 'N') or (cod_articulo = 'JV1D' and clase = 'N') or (cod_articulo = 'JV7D' and clase = 'N') or (cod_articulo = 'LIP1D' and clase = 'N') or (cod_articulo = 'MCM6' and clase = 'N') or (cod_articulo = 'MI2D' and clase = 'N') or (cod_articulo = 'MIC7E' and clase = 'N') or (cod_articulo = 'OF1' and clase = 'N') or (cod_articulo = 'OF2' and clase = 'N') or (cod_articulo = 'OMI1' and clase = 'N') or (cod_articulo = 'REG1D' and clase = 'N') or (cod_articulo = 'TAI1' and clase = 'N') or (cod_articulo = 'TRI1I' and clase = 'N') or (cod_articulo = 'TST1' and clase = 'C') or (cod_articulo = 'TST1' and clase = 'N') or (cod_articulo = 'TV13' and clase = 'N') or (cod_articulo = 'U4I' and clase = 'N') or (cod_articulo = 'UCEM7I' and clase = 'N') or (cod_articulo = 'VA35D' and clase = 'N') or (cod_articulo = 'VARM' and clase = 'N') or (cod_articulo = 'VI4DP' and clase = 'N') or (cod_articulo = 'AB6D' and clase = 'N') or (cod_articulo = 'AB7I' and clase = 'N') or (cod_articulo = 'AB8D' and clase = 'N') or (cod_articulo = 'AB6I-' and clase = 'N') or (cod_articulo = '35D' and clase = 'N') or (cod_articulo = '35I' and clase = 'N') or (cod_articulo = '38D' and clase = 'N') or (cod_articulo = '6L' and clase = 'N') or (cod_articulo = '7S' and clase = 'N') or (cod_articulo = 'ABC5I' and clase = 'N') or (cod_articulo = 'AGA11' and clase = 'N') or (cod_articulo = 'AGA18D' and clase = 'N') or (cod_articulo = 'AGA18I' and clase = 'N') or (cod_articulo = 'AGA19D' and clase = 'N') or (cod_articulo = 'AGA19I' and clase = 'N') or (cod_articulo = 'AGA3I' and clase = 'N') or (cod_articulo = 'AGA3I' and clase = 'S') or (cod_articulo = 'AGA5D' and clase = 'N') or (cod_articulo = 'AGA6D' and clase = 'N') or (cod_articulo = 'AGA6I' and clase = 'N') or (cod_articulo = 'AR4DP' and clase = 'N') or (cod_articulo = 'AR4IP' and clase = 'N') or (cod_articulo = 'AZ1I-' and clase = 'N') or (cod_articulo = 'AZ3D-' and clase = 'N') or (cod_articulo = 'AZ3I' and clase = 'N') or (cod_articulo = 'AZ6-' and clase = 'N') or (cod_articulo = 'BK1D' and clase = 'N') or (cod_articulo = 'CE3D' and clase = 'N') or (cod_articulo = 'CE5D-' and clase = 'N') or (cod_articulo = 'CE6D' and clase = 'N') or (cod_articulo = 'CI11D' and clase = 'N') or (cod_articulo = 'CI16D' and clase = 'N') or (cod_articulo = 'CI1D' and clase = 'N') or (cod_articulo = 'CI4D' and clase = 'N') or (cod_articulo = 'CI4DP' and clase = 'N') or (cod_articulo = 'CI4I' and clase = 'N') or (cod_articulo = 'CI5DP' and clase = 'N') or (cod_articulo = 'CI5IP' and clase = 'N') or (cod_articulo = 'CIIL' and clase = 'N') or (cod_articulo = 'CIS1D' and clase = 'N') or (cod_articulo = 'CIS3' and clase = 'N') or (cod_articulo = 'COR1D-' and clase = 'N') or (cod_articulo = 'CVL1D-' and clase = 'N') or (cod_articulo = 'CVL1I-' and clase = 'N') or (cod_articulo = 'CVL2D-' and clase = 'N') or (cod_articulo = 'CVL2I-' and clase = 'N') or (cod_articulo = 'CVL4' and clase = 'N') or (cod_articulo = 'DIA1' and clase = 'N') or (cod_articulo = 'DX6D' and clase = 'N') or (cod_articulo = 'ES1I' and clase = 'N') or (cod_articulo = 'FAC12D' and clase = 'N') or (cod_articulo = 'FAC1D' and clase = 'N') or (cod_articulo = 'FAC2D' and clase = 'N') or (cod_articulo = 'FAC7D' and clase = 'N') or (cod_articulo = 'FORTIS2I' and clase = 'N') or (cod_articulo = 'GIU1' and clase = 'N') or (cod_articulo = 'GLO3' and clase = 'N') or (cod_articulo = 'HEN1' and clase = 'N') or (cod_articulo = 'IB1' and clase = 'N') or (cod_articulo = 'ICA1-' and clase = 'N') or (cod_articulo = 'IF1I-' and clase = 'N') or (cod_articulo = 'IF35-' and clase = 'N') or (cod_articulo = 'IF4555-' and clase = 'N') or (cod_articulo = 'IF6070' and clase = 'N') or (cod_articulo = 'IFD20' and clase = 'N') or (cod_articulo = 'IFD25-' and clase = 'N') or (cod_articulo = 'IFD30' and clase = 'N') or (cod_articulo = 'IFI20' and clase = 'N') or (cod_articulo = 'IFI25' and clase = 'N') or (cod_articulo = 'IFI30' and clase = 'N') or (cod_articulo = 'IFI40' and clase = 'N') or (cod_articulo = 'IFI50' and clase = 'N') or (cod_articulo = 'IFI6070' and clase = 'N') or (cod_articulo = 'IL1D-' and clase = 'N') or (cod_articulo = 'IL1I-' and clase = 'N') or (cod_articulo = 'IS1D-' and clase = 'N') or (cod_articulo = 'IS3I' and clase = 'N') or (cod_articulo = 'IS4' and clase = 'N') or (cod_articulo = 'JAR1D' and clase = 'N') or (cod_articulo = 'JAR2I' and clase = 'N') or (cod_articulo = 'JAR5D' and clase = 'N') or (cod_articulo = 'JIS2I-' and clase = 'N') or (cod_articulo = 'JMA1D' and clase = 'N') or (cod_articulo = 'JMA1I' and clase = 'N') or (cod_articulo = 'JMA2D' and clase = 'N') or (cod_articulo = 'JMA2I' and clase = 'N') or (cod_articulo = 'JMA3I' and clase = 'N') or (cod_articulo = 'JMA4D' and clase = 'N') or (cod_articulo = 'JMA4I' and clase = 'N') or (cod_articulo = 'JMA9I-' and clase = 'N') or (cod_articulo = 'JO1' and clase = 'N') or (cod_articulo = 'LIN10D' and clase = 'N') or (cod_articulo = 'LIN10I' and clase = 'N') or (cod_articulo = 'LIN12D' and clase = 'N') or (cod_articulo = 'LIN12I' and clase = 'N') or (cod_articulo = 'LIN15I-' and clase = 'N') or (cod_articulo = 'LIN16' and clase = 'N') or (cod_articulo = 'LIN16D' and clase = 'N') or (cod_articulo = 'LIN1D' and clase = 'N') or (cod_articulo = 'LIN1I' and clase = 'N') or (cod_articulo = 'LIN2' and clase = 'N') or (cod_articulo = 'LIN3I-' and clase = 'N') or (cod_articulo = 'LIN5D-' and clase = 'N') or (cod_articulo = 'LIN5I-' and clase = 'N') or (cod_articulo = 'LO1D' and clase = 'N') or (cod_articulo = 'MC7S' and clase = 'N') or (cod_articulo = 'MCM12D' and clase = 'N') or (cod_articulo = 'MCM2D' and clase = 'N') or (cod_articulo = 'MCM4I-' and clase = 'N') or (cod_articulo = 'MCM5D-' and clase = 'N') or (cod_articulo = 'MCM7' and clase = 'N') or (cod_articulo = 'MCM8' and clase = 'N') or (cod_articulo = 'MER16' and clase = 'N') or (cod_articulo = 'MER16D' and clase = 'N') or (cod_articulo = 'MER1D-' and clase = 'N') or (cod_articulo = 'OJ4D' and clase = 'N') or (cod_articulo = 'STS1D-' and clase = 'N') or (cod_articulo = 'TE1I' and clase = 'N') or (cod_articulo = 'TEMD55' and clase = 'N') or (cod_articulo = 'TEMI55-' and clase = 'N') or (cod_articulo = 'TIF1D' and clase = 'N') or (cod_articulo = 'TRI12D' and clase = 'N') or (cod_articulo = 'TRI12I' and clase = 'N') or (cod_articulo = 'TRI13' and clase = 'N') or (cod_articulo = 'TRI8D' and clase = 'N') or (cod_articulo = 'TRI8I' and clase = 'N') or (cod_articulo = 'U6D-' and clase = 'N') or (cod_articulo = 'U6I' and clase = 'N') or (cod_articulo = 'UCEM1D' and clase = 'N') or (cod_articulo = 'UCEM1I-' and clase = 'N') or (cod_articulo = 'UCEM3' and clase = 'N') or (cod_articulo = 'UN11' and clase = 'N') or (cod_articulo = 'URKO3D' and clase = 'N') or (cod_articulo = 'URKO3I' and clase = 'N') or (cod_articulo = 'VA8D' and clase = 'N') or (cod_articulo = 'VI1D' and clase = 'N') or (cod_articulo = 'VI1I-' and clase = 'N') or (cod_articulo = 'VI2D' and clase = 'N') or (cod_articulo = 'VI2I-' and clase = 'N') or (cod_articulo = 'WEI1' and clase = 'N') or (cod_articulo = 'WEI5' and clase = 'N') or (cod_articulo = 'WIL1D' and clase = 'N') or (cod_articulo = 'YA11D' and clase = 'N') or (cod_articulo = 'YA1D-' and clase = 'N') or (cod_articulo = 'YA1I' and clase = 'N') or (cod_articulo = 'YA22D-' and clase = 'N') or (cod_articulo = 'YA27D' and clase = 'N') or (cod_articulo = 'YA3D' and clase = 'N') or (cod_articulo = 'LF7' and clase = 'N') or (cod_articulo = 'OJ14' and clase = 'N') or (cod_articulo = 'OJ14' and clase = 'S') or (cod_articulo = 'OJ16' and clase = 'N') or (cod_articulo = 'AGA5I-' and clase = 'N') or (cod_articulo = 'AZ1D-' and clase = 'N') or (cod_articulo = 'CAY1D-' and clase = 'N') or (cod_articulo = 'CIDL-' and clase = 'N') or (cod_articulo = 'CVL5D-' and clase = 'N') or (cod_articulo = 'CVL5I-' and clase = 'N') or (cod_articulo = 'CVL5I-' and clase = 'S') or (cod_articulo = 'DOM1D-' and clase = 'N') or (cod_articulo = 'EZ1I-' and clase = 'N') or (cod_articulo = 'FAC11D-' and clase = 'N') or (cod_articulo = 'FAC13D-' and clase = 'N') or (cod_articulo = 'FAC18' and clase = 'N') or (cod_articulo = 'IS3D-' and clase = 'N') or (cod_articulo = 'JIS1D-' and clase = 'N') or (cod_articulo = 'JMA3D' and clase = 'N') or (cod_articulo = 'JMA9D-' and clase = 'N') or (cod_articulo = 'LIN15D-' and clase = 'N') or (cod_articulo = 'LIN18' and clase = 'N') or (cod_articulo = 'LIN18D' and clase = 'N') or (cod_articulo = 'LIN3D-' and clase = 'N') or (cod_articulo = 'MCM13D-' and clase = 'N') or (cod_articulo = 'MCM4D-' and clase = 'N') or (cod_articulo = 'OJ9D' and clase = 'N') or (cod_articulo = 'OJ9D' and clase = 'S') or (cod_articulo = 'TE8I-' and clase = 'N') or (cod_articulo = 'TE8I-' and clase = 'S') or (cod_articulo = 'U5D-' and clase = 'N') or (cod_articulo = 'U5I-' and clase = 'N') or (cod_articulo = 'UCEM12-' and clase = 'N') or (cod_articulo = 'AB8I' and clase = 'N') or (cod_articulo = '38I' and clase = 'N') or (cod_articulo = 'AB11' and clase = 'N') or (cod_articulo = 'AB1D' and clase = 'N') or (cod_articulo = 'AB1I' and clase = 'N') or (cod_articulo = 'AB3I' and clase = 'N') or (cod_articulo = 'AB5D' and clase = 'N') or (cod_articulo = 'AB5I' and clase = 'N') or (cod_articulo = 'AB9D' and clase = 'N') or (cod_articulo = 'ABC1' and clase = 'N') or (cod_articulo = 'ABU13' and clase = 'N') or (cod_articulo = 'ABU14' and clase = 'N') or (cod_articulo = 'ABU1D' and clase = 'N') or (cod_articulo = 'ABU20' and clase = 'N') or (cod_articulo = 'ABU22D' and clase = 'N') or (cod_articulo = 'ABU25D' and clase = 'N') or (cod_articulo = 'ABU28' and clase = 'N') or (cod_articulo = 'ABU2I' and clase = 'N') or (cod_articulo = 'ABU38D' and clase = 'N') or (cod_articulo = 'ABU48' and clase = 'N') or (cod_articulo = 'ABU50' and clase = 'N') or (cod_articulo = 'ABU55' and clase = 'N') or (cod_articulo = 'ABU60' and clase = 'N') or (cod_articulo = 'ABU8D' and clase = 'N') or (cod_articulo = 'ABU8I' and clase = 'N') or (cod_articulo = 'AG10D' and clase = 'N') or (cod_articulo = 'AG10I' and clase = 'N') or (cod_articulo = 'AG11' and clase = 'N') or (cod_articulo = 'AG11D' and clase = 'N') or (cod_articulo = 'AG3D' and clase = 'N') or (cod_articulo = 'AG3I' and clase = 'N') or (cod_articulo = 'AG4D' and clase = 'N') or (cod_articulo = 'AG4I' and clase = 'N') or (cod_articulo = 'AG5D' and clase = 'N') or (cod_articulo = 'AG5I' and clase = 'N') or (cod_articulo = 'AG6D' and clase = 'N') or (cod_articulo = 'AG6I' and clase = 'N') or (cod_articulo = 'AG8D' and clase = 'N') or (cod_articulo = 'AG8I' and clase = 'N') or (cod_articulo = 'AG8RS' and clase = 'N') or (cod_articulo = 'AG8S' and clase = 'N') or (cod_articulo = 'AG9D' and clase = 'N') or (cod_articulo = 'AG9I' and clase = 'N') or (cod_articulo = 'AGA10' and clase = 'N') or (cod_articulo = 'AGA13I' and clase = 'N') or (cod_articulo = 'AGA16I' and clase = 'N') or (cod_articulo = 'AGA1I' and clase = 'N') or (cod_articulo = 'AGA20' and clase = 'N') or (cod_articulo = 'AGA24I' and clase = 'N') or (cod_articulo = 'AGA4D' and clase = 'N') or (cod_articulo = 'AGA4I' and clase = 'N') or (cod_articulo = 'AGA8D' and clase = 'N') or (cod_articulo = 'AGA9I' and clase = 'N') or (cod_articulo = 'AGE2D' and clase = 'N') or (cod_articulo = 'AMG5D' and clase = 'N') or (cod_articulo = 'ARE1D' and clase = 'N') or (cod_articulo = 'ARFE1D' and clase = 'N') or (cod_articulo = 'ARFE3D' and clase = 'N') or (cod_articulo = 'AS23D' and clase = 'N') or (cod_articulo = 'AS4D' and clase = 'N') or (cod_articulo = 'ASHH7' and clase = 'N') or (cod_articulo = 'ASME7' and clase = 'N') or (cod_articulo = 'ASN5' and clase = 'N') or (cod_articulo = 'ASN7' and clase = 'N') or (cod_articulo = 'ASNN7' and clase = 'N') or (cod_articulo = 'ASPR7' and clase = 'N') or (cod_articulo = 'AUM2D' and clase = 'N') or (cod_articulo = 'AZ17D' and clase = 'N') or (cod_articulo = 'AZ18' and clase = 'N') or (cod_articulo = 'AZ18D' and clase = 'N') or (cod_articulo = 'AZ2D-' and clase = 'N') or (cod_articulo = 'AZ4' and clase = 'N') or (cod_articulo = 'BAI1D' and clase = 'N') or (cod_articulo = 'BE5I' and clase = 'N') or (cod_articulo = 'BK2D' and clase = 'N') or (cod_articulo = 'BK7D' and clase = 'N') or (cod_articulo = 'BO2S' and clase = 'N') or (cod_articulo = 'BOM2D' and clase = 'N') or (cod_articulo = 'BRI14D' and clase = 'N') or (cod_articulo = 'BRI19' and clase = 'N') or (cod_articulo = 'BRI4I' and clase = 'N') or (cod_articulo = 'BRI6D' and clase = 'N') or (cod_articulo = 'BRI6I' and clase = 'N') or (cod_articulo = 'BUR19D' and clase = 'N') or (cod_articulo = 'BUR1D' and clase = 'N') or (cod_articulo = 'BUR2D' and clase = 'N') or (cod_articulo = 'BUR4D' and clase = 'N') or (cod_articulo = 'CA4D' and clase = 'N') or (cod_articulo = 'CA4I' and clase = 'N') or (cod_articulo = 'CA8D' and clase = 'N') or (cod_articulo = 'CAY1I' and clase = 'N') or (cod_articulo = 'CE3I' and clase = 'N') or (cod_articulo = 'CE6I' and clase = 'N') or (cod_articulo = 'CER1' and clase = 'N') or (cod_articulo = 'CF1D' and clase = 'N') or (cod_articulo = 'CHA2' and clase = 'N') or (cod_articulo = 'CHA2D' and clase = 'N') or (cod_articulo = 'CHEK1' and clase = 'N') or (cod_articulo = 'CI10D' and clase = 'N') or (cod_articulo = 'CI13' and clase = 'N') or (cod_articulo = 'CI15' and clase = 'N') or (cod_articulo = 'CI15D' and clase = 'N') or (cod_articulo = 'CI18' and clase = 'N') or (cod_articulo = 'CI1I' and clase = 'N') or (cod_articulo = 'CI27' and clase = 'N') or (cod_articulo = 'CI29' and clase = 'N') or (cod_articulo = 'CI36' and clase = 'N') or (cod_articulo = 'CI38D' and clase = 'N') or (cod_articulo = 'CI39D' and clase = 'N') or (cod_articulo = 'CI49' and clase = 'N') or (cod_articulo = 'CI51D' and clase = 'N') or (cod_articulo = 'CI6D' and clase = 'N') or (cod_articulo = 'CI7D' and clase = 'N') or (cod_articulo = 'CI8D' and clase = 'N') or (cod_articulo = 'CI9D' and clase = 'N') or (cod_articulo = 'CIF1D' and clase = 'N') or (cod_articulo = 'CIF2D' and clase = 'N') or (cod_articulo = 'CIF3' and clase = 'N') or (cod_articulo = 'CIL1' and clase = 'N') or (cod_articulo = 'CIL1D' and clase = 'N') or (cod_articulo = 'CIL3D' and clase = 'N') or (cod_articulo = 'CIS2' and clase = 'N') or (cod_articulo = 'CL3I' and clase = 'N') or (cod_articulo = 'COM' and clase = 'N') or (cod_articulo = 'COR11' and clase = 'N') or (cod_articulo = 'COR12' and clase = 'N') or (cod_articulo = 'COR13D' and clase = 'N') or (cod_articulo = 'COR17D' and clase = 'N') or (cod_articulo = 'COR19D' and clase = 'N') or (cod_articulo = 'COR27D' and clase = 'N') or (cod_articulo = 'COR40' and clase = 'N') or (cod_articulo = 'COR7' and clase = 'N') or (cod_articulo = 'CUB1' and clase = 'N') or (cod_articulo = 'DOM12' and clase = 'N') or (cod_articulo = 'DOM12D' and clase = 'N') or (cod_articulo = 'DOM13D' and clase = 'N') or (cod_articulo = 'DOM14D' and clase = 'N') or (cod_articulo = 'DOM1I' and clase = 'N') or (cod_articulo = 'DOM21D' and clase = 'N') or (cod_articulo = 'DOM2D' and clase = 'N') or (cod_articulo = 'DOM49D' and clase = 'N') or (cod_articulo = 'DOM9D' and clase = 'N') or (cod_articulo = 'DX5D' and clase = 'N') or (cod_articulo = 'DX6' and clase = 'N') or (cod_articulo = 'EMK1' and clase = 'N') or (cod_articulo = 'EU4D' and clase = 'N') or (cod_articulo = 'EV1' and clase = 'N') or (cod_articulo = 'EV2' and clase = 'N') or (cod_articulo = 'EZ1D' and clase = 'N') or (cod_articulo = 'EZ2I' and clase = 'N') or (cod_articulo = 'FAC10D' and clase = 'N') or (cod_articulo = 'FAC14D' and clase = 'N') or (cod_articulo = 'FAC3D' and clase = 'N') or (cod_articulo = 'FAC4D' and clase = 'N') or (cod_articulo = 'FAC5D' and clase = 'N') or (cod_articulo = 'FAC8D' and clase = 'N') or (cod_articulo = 'FAIN1I' and clase = 'N') or (cod_articulo = 'FAS1' and clase = 'N') or (cod_articulo = 'FF10D' and clase = 'N') or (cod_articulo = 'FF1D' and clase = 'N') or (cod_articulo = 'FF2' and clase = 'N') or (cod_articulo = 'FF2D' and clase = 'N') or (cod_articulo = 'FF3' and clase = 'N') or (cod_articulo = 'FR11D' and clase = 'N') or (cod_articulo = 'FTH1' and clase = 'N') or (cod_articulo = 'FTH11D' and clase = 'N') or (cod_articulo = 'FTH3' and clase = 'N') or (cod_articulo = 'FTH5' and clase = 'N') or (cod_articulo = 'FTH8' and clase = 'N') or (cod_articulo = 'FTH9' and clase = 'N') or (cod_articulo = 'GE1D' and clase = 'N') or (cod_articulo = 'GE3D' and clase = 'N') or (cod_articulo = 'GIU1D' and clase = 'N') or (cod_articulo = 'GIU2' and clase = 'N') or (cod_articulo = 'GLO1D' and clase = 'N') or (cod_articulo = 'GLO1I' and clase = 'N') or (cod_articulo = 'GLO5I' and clase = 'N') or (cod_articulo = 'GR1D' and clase = 'N') or (cod_articulo = 'GR2D' and clase = 'N') or (cod_articulo = 'GR2I' and clase = 'N') or (cod_articulo = 'IB2' and clase = 'N') or (cod_articulo = 'ICS2D' and clase = 'N') or (cod_articulo = 'IF15' and clase = 'N') or (cod_articulo = 'IF5' and clase = 'N') or (cod_articulo = 'IFI51' and clase = 'N') or (cod_articulo = 'IL2' and clase = 'N') or (cod_articulo = 'INGA' and clase = 'N') or (cod_articulo = 'INGD' and clase = 'N') or (cod_articulo = 'INGW' and clase = 'N') or (cod_articulo = 'IS15' and clase = 'N') or (cod_articulo = 'IS1I' and clase = 'N') or (cod_articulo = 'IS2D' and clase = 'N') or (cod_articulo = 'IS5D' and clase = 'N') or (cod_articulo = 'IS7D' and clase = 'N') or (cod_articulo = 'JAR2D' and clase = 'N') or (cod_articulo = 'JAR3' and clase = 'N') or (cod_articulo = 'JAR4D' and clase = 'N') or (cod_articulo = 'JAR5I' and clase = 'N') or (cod_articulo = 'JNG1D' and clase = 'N') or (cod_articulo = 'JPM2I' and clase = 'N') or (cod_articulo = 'JU1' and clase = 'N') or (cod_articulo = 'JV2' and clase = 'N') or (cod_articulo = 'JV3I' and clase = 'N') or (cod_articulo = 'JV4I' and clase = 'N') or (cod_articulo = 'JV5I' and clase = 'N') or (cod_articulo = 'JV6' and clase = 'N') or (cod_articulo = 'JV7' and clase = 'N') or (cod_articulo = 'KAE5' and clase = 'N') or (cod_articulo = 'KAE6D' and clase = 'N') or (cod_articulo = 'KAE8' and clase = 'N') or (cod_articulo = 'KAE8D' and clase = 'N') or (cod_articulo = 'KAE9' and clase = 'N') or (cod_articulo = 'KEYABT' and clase = 'N') or (cod_articulo = 'KFV1' and clase = 'N') or (cod_articulo = 'KWI1' and clase = 'N') or (cod_articulo = 'LF15' and clase = 'N') or (cod_articulo = 'LF17' and clase = 'N') or (cod_articulo = 'LF1D' and clase = 'N') or (cod_articulo = 'LF1I' and clase = 'N') or (cod_articulo = 'LIN14D' and clase = 'N') or (cod_articulo = 'LIN20D' and clase = 'N') or (cod_articulo = 'LIN4D' and clase = 'N') or (cod_articulo = 'LIN6D' and clase = 'N') or (cod_articulo = 'LIN8D' and clase = 'N') or (cod_articulo = 'LIN8I' and clase = 'N') or (cod_articulo = 'LIN9' and clase = 'N') or (cod_articulo = 'LO1I' and clase = 'N') or (cod_articulo = 'LO3D' and clase = 'N') or (cod_articulo = 'LUMA1D' and clase = 'N') or (cod_articulo = 'LUMA2I' and clase = 'N') or (cod_articulo = 'LUMA3D' and clase = 'N') or (cod_articulo = 'MAS2D' and clase = 'N') or (cod_articulo = 'MAS3D' and clase = 'N') or (cod_articulo = 'MAS4D' and clase = 'N') or (cod_articulo = 'MCH1D' and clase = 'N') or (cod_articulo = 'MCH2D' and clase = 'N') or (cod_articulo = 'MCM1' and clase = 'N') or (cod_articulo = 'MCM169' and clase = 'N') or (cod_articulo = 'MCM18D' and clase = 'N') or (cod_articulo = 'MCM26' and clase = 'N') or (cod_articulo = 'MCM3D' and clase = 'N') or (cod_articulo = 'MEL' and clase = 'N') or (cod_articulo = 'MEL1' and clase = 'N') or (cod_articulo = 'MER15' and clase = 'N') or (cod_articulo = 'MER17' and clase = 'N') or (cod_articulo = 'MER24S' and clase = 'N') or (cod_articulo = 'MER3I' and clase = 'N') or (cod_articulo = 'MET2D' and clase = 'N') or (cod_articulo = 'MGA1' and clase = 'N') or (cod_articulo = 'MGA1D' and clase = 'N') or (cod_articulo = 'MQ1D' and clase = 'N') or (cod_articulo = 'MQ1I' and clase = 'N') or (cod_articulo = 'NO1' and clase = 'N') or (cod_articulo = 'OJ2I' and clase = 'N') or (cod_articulo = 'OJ3D' and clase = 'N') or (cod_articulo = 'OJ3I' and clase = 'N') or (cod_articulo = 'OJ6D' and clase = 'N') or (cod_articulo = 'OJJ' and clase = 'N') or (cod_articulo = 'OJK' and clase = 'N') or (cod_articulo = 'OJL' and clase = 'N') or (cod_articulo = 'OJM' and clase = 'N') or (cod_articulo = 'OM1' and clase = 'N') or (cod_articulo = 'PAP1' and clase = 'N') or (cod_articulo = 'PAP2' and clase = 'N') or (cod_articulo = 'PHI52' and clase = 'N') or (cod_articulo = 'PR15D' and clase = 'N') or (cod_articulo = 'PR16D' and clase = 'N') or (cod_articulo = 'PR5D' and clase = 'N') or (cod_articulo = 'PR6' and clase = 'N') or (cod_articulo = 'PR7' and clase = 'N') or (cod_articulo = 'PR9' and clase = 'N') or (cod_articulo = 'RO10D' and clase = 'N') or (cod_articulo = 'RO16D' and clase = 'N') or (cod_articulo = 'RO24D' and clase = 'N') or (cod_articulo = 'RO29D' and clase = 'N') or (cod_articulo = 'RO36D' and clase = 'N') or (cod_articulo = 'RO37D' and clase = 'N') or (cod_articulo = 'RO8I' and clase = 'N') or (cod_articulo = 'RU10D' and clase = 'N') or (cod_articulo = 'RU5D' and clase = 'N') or (cod_articulo = 'RU9D' and clase = 'N') or (cod_articulo = 'SCO1' and clase = 'N') or (cod_articulo = 'SEL2D' and clase = 'N') or (cod_articulo = 'SIS2' and clase = 'N') or (cod_articulo = 'SLG4' and clase = 'N') or (cod_articulo = 'SLG5' and clase = 'N') or (cod_articulo = 'SOFI1I' and clase = 'N') or (cod_articulo = 'SOFI2D' and clase = 'N') or (cod_articulo = 'SOFI2I' and clase = 'N') or (cod_articulo = 'SOFI3I' and clase = 'N') or (cod_articulo = 'SS12S' and clase = 'N') or (cod_articulo = 'SSP1RS' and clase = 'N') or (cod_articulo = 'ST1I' and clase = 'N') or (cod_articulo = 'STS13D' and clase = 'N') or (cod_articulo = 'STS1I' and clase = 'N') or (cod_articulo = 'STS3D' and clase = 'N') or (cod_articulo = 'STS6D' and clase = 'N') or (cod_articulo = 'STUV1D' and clase = 'N') or (cod_articulo = 'TE11D' and clase = 'N') or (cod_articulo = 'TE24' and clase = 'N') or (cod_articulo = 'TE28' and clase = 'N') or (cod_articulo = 'TE7D' and clase = 'N') or (cod_articulo = 'TE8D' and clase = 'N') or (cod_articulo = 'TE8DKT1' and clase = 'N') or (cod_articulo = 'TE9D' and clase = 'N') or (cod_articulo = 'TEMD35' and clase = 'N') or (cod_articulo = 'TEU1' and clase = 'N') or (cod_articulo = 'TOK6D' and clase = 'N') or (cod_articulo = 'TOV3' and clase = 'N') or (cod_articulo = 'TRI10D' and clase = 'N') or (cod_articulo = 'TRI11D' and clase = 'N') or (cod_articulo = 'TRI11I' and clase = 'N') or (cod_articulo = 'TRI17D' and clase = 'N') or (cod_articulo = 'TRI2I' and clase = 'N') or (cod_articulo = 'TRI3D' and clase = 'N') or (cod_articulo = 'TRI3I' and clase = 'N') or (cod_articulo = 'TRI7D' and clase = 'N') or (cod_articulo = 'TRI7I' and clase = 'N') or (cod_articulo = 'TRI9D' and clase = 'N') or (cod_articulo = 'TRI9I' and clase = 'N') or (cod_articulo = 'TV2D' and clase = 'N') or (cod_articulo = 'U15D' and clase = 'N') or (cod_articulo = 'U2D' and clase = 'N') or (cod_articulo = 'U3D' and clase = 'N') or (cod_articulo = 'U3I' and clase = 'N') or (cod_articulo = 'UCEM7D' and clase = 'N') or (cod_articulo = 'UL4' and clase = 'N') or (cod_articulo = 'UMF1' and clase = 'N') or (cod_articulo = 'VA1' and clase = 'N') or (cod_articulo = 'VA12D' and clase = 'N') or (cod_articulo = 'VA14D' and clase = 'N') or (cod_articulo = 'VA2' and clase = 'N') or (cod_articulo = 'VA30' and clase = 'N') or (cod_articulo = 'VA4' and clase = 'N') or (cod_articulo = 'VA75D' and clase = 'N') or (cod_articulo = 'VADHP' and clase = 'N') or (cod_articulo = 'VI4I' and clase = 'N') or (cod_articulo = 'VI5D' and clase = 'N') or (cod_articulo = 'VI7' and clase = 'N') or (cod_articulo = 'VI9D' and clase = 'N') or (cod_articulo = 'VLLAVESP' and clase = 'N') or (cod_articulo = 'WE5D' and clase = 'N') or (cod_articulo = 'WEI2' and clase = 'N') or (cod_articulo = 'WEI3' and clase = 'N') or (cod_articulo = 'WIL5D' and clase = 'N') or (cod_articulo = 'YA11I' and clase = 'N') or (cod_articulo = 'YA12I' and clase = 'N') or (cod_articulo = 'YA17D' and clase = 'N') or (cod_articulo = 'YA22I' and clase = 'N') or (cod_articulo = 'YA27' and clase = 'N') or (cod_articulo = 'YA2D' and clase = 'N') or (cod_articulo = 'YA3I' and clase = 'N') or (cod_articulo = 'YA5D' and clase = 'N') or (cod_articulo = 'YA6D' and clase = 'N') or (cod_articulo = 'YA8D' and clase = 'N') or (cod_articulo = 'YA8I' and clase = 'N') or (cod_articulo = 'YET1' and clase = 'N') or (cod_articulo = 'YET2D' and clase = 'N') or (cod_articulo = 'YT3S' and clase = 'N') or (cod_articulo = 'ZE5D' and clase = 'N') or (cod_articulo = 'ZE5I' and clase = 'N') or (cod_articulo = 'ZE6D' and clase = 'N') or (cod_articulo = 'BUR10D' and clase = 'N') or (cod_articulo = 'BUR11D' and clase = 'N') or (cod_articulo = 'BUR9D' and clase = 'N') or (cod_articulo = 'CHI1' and clase = 'N') or (cod_articulo = 'CSB1D' and clase = 'N') or (cod_articulo = 'CSB2D' and clase = 'N') or (cod_articulo = 'EU1' and clase = 'N') or (cod_articulo = 'EU10D' and clase = 'N') or (cod_articulo = 'EU2' and clase = 'N') or (cod_articulo = 'EU3' and clase = 'N') or (cod_articulo = 'EU6' and clase = 'N') or (cod_articulo = 'EU7D' and clase = 'N') or (cod_articulo = 'EU8D' and clase = 'N') or (cod_articulo = 'EVE1' and clase = 'N') or (cod_articulo = 'FIC1' and clase = 'N') or (cod_articulo = 'FIC7' and clase = 'N') or (cod_articulo = 'FR1D' and clase = 'N') or (cod_articulo = 'HAF1' and clase = 'N') or (cod_articulo = 'HAF1D' and clase = 'N') or (cod_articulo = 'HAF2D' and clase = 'N') or (cod_articulo = 'JOM1D' and clase = 'N') or (cod_articulo = 'LAS4' and clase = 'N') or (cod_articulo = 'LAS5' and clase = 'N') or (cod_articulo = 'LAS5D' and clase = 'N') or (cod_articulo = 'LF11' and clase = 'N') or (cod_articulo = 'LF13D' and clase = 'N') or (cod_articulo = 'LF14D' and clase = 'N') or (cod_articulo = 'LF16' and clase = 'N') or (cod_articulo = 'LF2' and clase = 'N') or (cod_articulo = 'LF26' and clase = 'N') or (cod_articulo = 'LF29D' and clase = 'N') or (cod_articulo = 'LF31' and clase = 'N') or (cod_articulo = 'LF34' and clase = 'N') or (cod_articulo = 'LF7D' and clase = 'N') or (cod_articulo = 'MBL1' and clase = 'N') or (cod_articulo = 'MLM5' and clase = 'N') or (cod_articulo = 'MSV1' and clase = 'N') or (cod_articulo = 'MSV2' and clase = 'N') or (cod_articulo = 'OJ10' and clase = 'N') or (cod_articulo = 'OJ12' and clase = 'N') or (cod_articulo = 'OJ13' and clase = 'N') or (cod_articulo = 'OJ17' and clase = 'N') or (cod_articulo = 'SA1' and clase = 'N') or (cod_articulo = 'SLG1' and clase = 'N') or (cod_articulo = 'SLG2' and clase = 'N') or (cod_articulo = 'SOF1' and clase = 'N') or (cod_articulo = 'SOF2' and clase = 'N') or (cod_articulo = 'SSO2' and clase = 'N') or (cod_articulo = 'ABA1' and clase = 'N') or (cod_articulo = 'AGE1I' and clase = 'N') or (cod_articulo = 'AR1D' and clase = 'N') or (cod_articulo = 'LF25' and clase = 'N') or (cod_articulo = 'RO39' and clase = 'N') or (cod_articulo = 'SSO1' and clase = 'N') or (cod_articulo = 'PR1' and clase = 'N') or (cod_articulo = 'MBL1D' and clase = 'N') or (cod_articulo = '26M' and clase = 'N') or (cod_articulo = 'AB2I' and clase = 'N') or (cod_articulo = 'ABC5D' and clase = 'N') or (cod_articulo = 'ABU2D' and clase = 'N') or (cod_articulo = 'COR30' and clase = 'N') or (cod_articulo = 'COR5060' and clase = 'N') or (cod_articulo = 'ES1D' and clase = 'N') or (cod_articulo = 'FAC1I' and clase = 'N') or (cod_articulo = 'FAC2I' and clase = 'N') or (cod_articulo = 'HEN1D' and clase = 'N') or (cod_articulo = 'MCM5I' and clase = 'N') or (cod_articulo = 'PR4I' and clase = 'N') or (cod_articulo = 'RI1D' and clase = 'N') or (cod_articulo = 'RI1I' and clase = 'N') or (cod_articulo = 'U4D' and clase = 'N') or (cod_articulo = 'VI4IP' and clase = 'N') or (cod_articulo = 'WE4D' and clase = 'N') or (cod_articulo = 'WE4I' and clase = 'N') or (cod_articulo = 'WE5I' and clase = 'N') )

Explain results for this 'baby' query
id  	 select_type  	 table  	 type  	 possible_keys  	 key  	 key_len  	 ref  	 rows  	 Extra
1 	SIMPLE 	prepara_sales_mix 	range 	fecha,cod_art 	fecha 	3 	NULL 	317504 	Using where


Ok, here it is, oh! one more thing:

This is part of a complex process, try to imagine about 75 querys, maybe 10 or 20 biggers, 30 from medium and the rest for smalls. If I put only 1 month(m1), compared with same month from past year(m2), and other month (remember the process is always made of pairs, like clas<->cod_art)(m3) compared with the same month past year(m4) [m1!=m2!=m3!=m4] it tooks about 20 minutes... if use the force index command with fecha(data) index (The best), it tooks about 17 or 18 minutes...

Can I make it faster??? Any ideas???

--------
Summary tables:

Well, in fact, this table (prepara_sales_mix), is a summary table made from other bigger so if I use other summary table... the maintenance and execution of the process will be eternal ...

pd: As you can see, isn't easy... and yes, I am not using the same value for clas...

Thanks for all.

Options: ReplyQuote




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.