Quantcast
Channel: SQLServerCentral » SQL Server 7,2000 » Administration » Latest topics
Viewing all articles
Browse latest Browse all 482

Query is consuming hoge transaction log

$
0
0
The following script is takeing hrs to complete and consuming 100GB of Transaction log in Dev environment,DECLARE @THIS_CALENDAR_YR_START_DT INT SET @THIS_CALENDAR_YR_START_DT = (SELECT CAST(THIS_CALENDAR_YR_START_DT AS INT) FROM ECDI) TRUNCATE TABLE EISRCYR INSERT INTO EISRCYR SELECT Col1,Col2,Col3,Col4,Col5,Col6,Col7,Col8,Col9,Col10,Col11,Col12,Col13,Col14,Col15,Col16,Col17,Col18,Col19,Col20,Col21,Col22,Col23,Col24,Col25,Col26,,SUM(QUANTITY) QUANTITY ,SUM(DEALER_SALES) DEALER_SALES FROM VERSC WHERE TIME_SID >= @THIS_CALENDAR_YR_START_DT GROUP BY Col1,Col2,Col3,Col4,Col5,Col6,Col7,Col8,Col9,Col10,Col11,Col12,Col13,Col14,Col15,Col16,Col17,Col18,Col19,Col20,Col21,Col22,Col23,Col24,Col25,Col26, UNION ALL DECLARE @THIS_CALENDAR_YR_START_DT INT SET @THIS_CALENDAR_YR_START_DT = (SELECT CAST(THIS_CALENDAR_YR_START_DT AS INT) FROM ECDI) select Col1,Col2,Col3,Col4,Col5,Col6,Col7,Col8,Col9,Col10,Col11,Col12,Col13,Col14,Col15,Col16,Col17,Col18,Col19,Col20,Col21,Col22,Col23,Col24,Col25,Col26,,SUM(A.QUANTITY) QUANTITY ,SUM(A.DEALER_SALES ) DEALER_SALES FROM VEB A ,VETC B ,VECC C ,VETP D ,VECP E WHERE A.TYPE2_CUSTOMER_SID = B.TYPE2_CUSTOMER_SID AND B.CUSTOMER_NO = C.CUSTOMER_NO AND A.TYPE2_PRODUCT_SID = D.TYPE2_PRODUCT_SID AND D.PRODUCT_NO = E.PRODUCT_NO AND C.MAJOR_BUY_GROUP_CD <> 'RET' AND A.TIME_SID >= @THIS_CALENDAR_YR_START_DT GROUP BY Col1,Col2,Col3,Col4,Col5,Col6,Col7,Col8,Col9,Col10,Col11,Col12,Col13,Col14,Col15,Col16,Col17,Col18,Col19,Col20,Col21,Col22,Col23,Col24,Col25,Col26, TRUNCATE TABLE EISRCINSERT INTO EISRCSELECT * FROM TEISRPYR UNION ALL SELECT * FROM EISRCYR DELETE EISRCWHERE TIME_SID = 1 The same query is running in production within 20 mins.Dev environment and production both has 3 GB RAM.Nos of processor is double in Dev environment.Dev environment also hosts SQL 2008 instance along with SQL 2000.Can suggest how can I fix the issue and what is the reason for the issue?

Viewing all articles
Browse latest Browse all 482

Trending Articles