Thread: Query very slow
Hi all Hi all I have a query that the excution es very slow, my query is: "select count(B.fil) as juntas, sum(C.column1),sum(C.column2), sum(C.column3),sum(C.column4), sum(C.column5,sum(C.column6)from table1 B, table2 C where C.tipo=1 and B.codigo=15 and C.fil=B.fil" The main table have 37824 rows nad I have index for the two tables. How can I to improve better execution time at this query? Regards _________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp
On Sat, 10 Nov 2001, Luz Lopez wrote: > I have a query that the excution es very slow, my query is: > > "select count(B.fil) as juntas, sum(C.column1),sum(C.column2), sum(C.column3),sum(C.column4), sum(C.column5,sum(C.column6)from table1 B, table2 C where C.tipo=1 and B.codigo=15 and C.fil=B.fil" > > The main table have 37824 rows nad I have index for the two tables. > > How can I to improve better execution time at this query? How about if you show us the output from "explain". Also you did not specify what you had the indexes on. Which is the main table? You are using 3 tables on this query.
Sorry I forgot to show the tables and indexes. Table1 table2 ===================================== fil int fil int tipo int codigo int column1 int descripcion vachar(120) column2 int descripcion1 varchar(120) column3 int column4 int column5 int column6 int The indexes is for table1 tabl_idx1(fil,tipo), tab1_idx2(fil) for table2 is tab2_idx1(fil), tab2_idx2(fil,codigo) Thanks in advanced, Regards, > > I have a query that the excution es very slow, my query is: > > > > "select count(B.fil) as juntas, > sum(C.column1),sum(C.column2), > sum(C.column3),sum(C.column4), > sum(C.column5,sum(C.column6)from table1 B, table2 C > where C.tipo=1 and B.codigo=15 and C.fil=B.fil" > > > > The main table have 37824 rows nad I have index for the two tables. > > > > How can I to improve better execution time at this query? > >How about if you show us the output from "explain". >Also you did not specify what you had the indexes on. >Which is the main table? You are using 3 tables on this query. > _________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp