473,395 Members | 1,652 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Materialize View

ORIGINAL MATERIALIZE VIEW QUERY:-

Expand|Select|Wrap|Line Numbers
  1.  
  2. select gb.SET_OF_BOOKS_ID                     "SOB_ID" 
  3. ,      gcc.CODE_COMBINATION_ID                "CCID" 
  4. ,      gp.period_name 
  5. ,      gb.ACTUAL_FLAG 
  6. ,      gcc.segment1 
  7. ,      gcc.segment2 
  8. ,      gcc.segment3 
  9. ,      gcc.segment4 
  10. ,      gcc.segment5 
  11. ,      gcc.segment6 
  12. ,      gcc.segment7 
  13. ,      gcc.segment8 
  14. ,      gcc.segment9 
  15. ,      gcc.segment10 
  16. ,      gcc.segment11 
  17. ,      gcc.segment12 
  18. ,      gcc.segment13 
  19. ,      gcc.segment14 
  20. /*,      gcc.segment15 
  21. ,      gcc.segment16 
  22. ,      gcc.segment17 
  23. ,      gcc.segment18 
  24. ,      gcc.segment19 
  25. ,      gcc.segment20 
  26. ,      gcc.segment21 
  27. ,      gcc.segment22 
  28. ,      gcc.segment23 
  29. ,      gcc.segment24 
  30. ,      gcc.segment25 
  31. ,      gcc.segment26 
  32. ,      gcc.segment27 
  33. ,      gcc.segment28 
  34. ,      gcc.segment29 
  35. ,      gcc.segment30*/ 
  36. ,      gb.currency_code 
  37. ,      gb.period_year 
  38. ,      gb.period_num 
  39. ,      (nvl(gb.BEGIN_BALANCE_DR,0)-nvl(gb.BEGIN_BALANCE_CR,0)) Open_Bal 
  40. ,      nvl(gb.PERIOD_NET_DR,0) Period_Dr 
  41. ,      nvl(gb.PERIOD_NET_CR,0) Period_Cr 
  42. ,      (nvl(gb.BEGIN_BALANCE_DR,0)-nvl(gb.BEGIN_BALANCE_CR,0)+nvl(gb.PERIOD_NET_DR,0)-nvl(gb.PERIOD_NET_CR,0)) Close_Bal 
  43. ,      nvl(gb.BEGIN_BALANCE_DR,0) Open_Bal_Dr 
  44. ,      nvl(gb.BEGIN_BALANCE_CR,0) Open_Bal_Cr 
  45. ,      nvl(gb.BEGIN_BALANCE_DR,0) + nvl(gb.PERIOD_NET_DR,0)  Close_Bal_Dr 
  46. ,      nvl(gb.BEGIN_BALANCE_CR,0) + nvl(gb.PERIOD_NET_CR,0)  Close_Bal_Cr 
  47. from   gl_balances               gb 
  48. ,      gl_code_combinations      gcc 
  49. ,      gl_periods                gp 
  50. where  gcc.CODE_COMBINATION_ID = gb.CODE_COMBINATION_ID 
  51. and    gb.period_year          = gp.period_year 
  52. and    gb.period_num           = gp.period_num 
  53. and    gb.period_type          = gp.period_type 
  54. and    gcc.summary_flag       != 'Y'
  55.  
  56.  
Creation of materialize view using above qury tabkes10 minutes.

QUERY LOGIC:-
Query Logic is developed to NET of the balances if the SOURCE is 'Payables' else need not.

MODIFIED QUERY LOGIC:-

Expand|Select|Wrap|Line Numbers
  1.  
  2. select  /*+ index(gcc GL_CODE_COMBINATIONS_U1) , 
  3.            gl GL_JE_LINES_U1  */ 
  4. distinct  gb.SET_OF_BOOKS_ID           "SOB_ID" 
  5. ,      gcc.CODE_COMBINATION_ID         "CCID" 
  6. ,      gp.period_name 
  7. ,      gb.ACTUAL_FLAG 
  8. ,      gcc.segment1 
  9. ,      gcc.segment2 
  10. ,      gcc.segment3 
  11. ,      gcc.segment4 
  12. ,      gcc.segment5 
  13. ,      gcc.segment6 
  14. ,      gcc.segment7 
  15. ,      gcc.segment8 
  16. ,      gcc.segment9 
  17. ,      gcc.segment10 
  18. ,      gcc.segment11 
  19. ,      gcc.segment12 
  20. ,      gcc.segment13 
  21. ,      gcc.segment14 
  22. /*,    gcc.segment15 
  23. ,      gcc.segment16 
  24. ,      gcc.segment17 
  25. ,      gcc.segment18 
  26. ,      gcc.segment19 
  27. ,      gcc.segment20 
  28. ,      gcc.segment21 
  29. ,      gcc.segment22 
  30. ,      gcc.segment23 
  31. ,      gcc.segment24 
  32. ,      gcc.segment25 
  33. ,      gcc.segment26 
  34. ,      gcc.segment27 
  35. ,      gcc.segment28 
  36. ,      gcc.segment29 
  37. ,      gcc.segment30 */ 
  38. ,     gb.currency_code 
  39. ,      gb.period_year 
  40. ,      gb.period_num 
  41. ,      (nvl(gb.BEGIN_BALANCE_DR,0)-nvl(gb.BEGIN_BALANCE_CR,0)) Open_Bal 
  42. ,      (nvl(gb.PERIOD_NET_DR,0)) Period_Dr 
  43. ,      (nvl(gb.PERIOD_NET_CR,0)) Period_Cr 
  44. ,     (nvl(gb.BEGIN_BALANCE_DR,0)-nvl(gb.BEGIN_BALANCE_CR,0)+nvl(gb.PERIOD_NET_DR,0)-nvl(gb.PERIOD_NET_CR,0)) Close_Bal 
  45. ,     (nvl(gb.BEGIN_BALANCE_DR,0)) Open_Bal_Dr 
  46. ,      (nvl(gb.BEGIN_BALANCE_CR,0)) Open_Bal_Cr 
  47. --Added by Altaf 29-NOV-2007 
  48. ,(decode(gh.je_source,'Payables', 
  49.     to_number( NVL (gb.begin_balance_dr, 0) - NVL (gb.begin_balance_cr, 0) + NVL (gb.period_net_dr, 0) - NVL (gb.period_net_cr, 0)), 
  50.     nvl(gb.BEGIN_BALANCE_DR,0) + nvl(gb.PERIOD_NET_DR,0))) Close_Bal_Dr 
  51. ,(decode(gh.je_source,'Payables', 
  52.        DECODE(sign(  NVL (gb.begin_balance_dr, 0) - NVL (gb.begin_balance_cr, 0) + NVL (gb.period_net_dr, 0) - NVL (gb.period_net_cr, 0)),-1,0,0), 
  53.         (nvl(gb.BEGIN_BALANCE_CR,0) + nvl(gb.PERIOD_NET_CR,0))) ) Close_Bal_Cr 
  54. --Added by Altaf 29-NOV-2007 
  55. from   gl_balances               gb 
  56. ,      gl_code_combinations      gcc 
  57. ,      gl_periods                gp 
  58. ,      gl_je_headers             gh 
  59. ,      gl_je_lines               gl 
  60. ,      gl_sets_of_books               gs 
  61. where  gcc.CODE_COMBINATION_ID = gb.CODE_COMBINATION_ID 
  62. and    gb.period_year          = gp.period_year 
  63. and    gb.period_num           = gp.period_num 
  64. and    gb.period_type          = gp.period_type 
  65. and    gb.CODE_COMBINATION_ID  = gl.CODE_COMBINATION_ID 
  66. and    gl.je_header_id         = gh.je_header_id 
  67. and    gl.period_name          = gh.period_name 
  68. and    gb.SET_OF_BOOKS_ID      = gs.SET_OF_BOOKS_ID 
  69. and    gb.SET_OF_BOOKS_ID      = gl.SET_OF_BOOKS_ID 
  70. and    gb.SET_OF_BOOKS_ID      = gh.SET_OF_BOOKS_ID 
  71. and    gs.SET_OF_BOOKS_ID      = 1 
  72. AND    GB.PERIOD_YEAR =(select to_char(trunc(add_months(sysdate,-3)),'RRRR') from dual)   
  73. AND    GB.period_name = (select to_char(trunc(add_months(sysdate,-3)),'MON-RR') from dual) 
  74.  
  75.  
When i try to create Materialize view [ FOR MONTH OF SEP-07] using above qury it takes 4 hours and then it errors out with error message --> "ORA-01652: unable to extend temp segment by 128 in tablespace TEMP"

I had discussion with the DBA to increase size of TEMPSPACE but i was told it is already 32 GB and cannot be extended more.
In this case what steps i should follow to increase the performance of the modified query so that materialized view gets created or any other steps need to follow.

There are 20000000 [2 cored] records in GL_JE_LINES itself.

STATISTICS GATHERED:- EXPLAIN PLAN


Operation Object Name Rows Bytes Cost Object Node In/Out PStart PStop

SELECT STATEMENT Optimizer Mode=CHOOSE 19 K 20177
SORT UNIQUE 19 K 3 M 20177
HASH JOIN 19 K 3 M 19589
HASH JOIN 19 K 2 M 18271
TABLE ACCESS FULL GL_PERIODS 920 18 K 5
HASH JOIN 33 K 2 M 18264
TABLE ACCESS BY INDEX ROWID GL_BALANCES 24 K 1 M 10103
INDEX RANGE SCAN GL_BALANCES_N2 1 535
TABLE ACCESS FULL DUAL 1 2
TABLE ACCESS FULL DUAL 1 2
TABLE ACCESS BY INDEX ROWID GL_JE_LINES 739 15 K 2
NESTED LOOPS 2 M 102 M 6671
NESTED LOOPS 3 K 74 K 59
INDEX UNIQUE SCAN GL_SETS_OF_BOOKS_U2 1 3
TABLE ACCESS FULL GL_JE_HEADERS 3 K 64 K 58
INDEX RANGE SCAN GL_JE_LINES_U1 35 K 1
TABLE ACCESS BY INDEX ROWID GL_CODE_COMBINATIONS 302 K 25 M 826
INDEX FULL SCAN GL_CODE_COMBINATIONS_U1 1 26
Dec 4 '07 #1
1 3667
Dave44
153 100+
Hi can you please provide the create table statements and relevant create index statements? other wise it makes it tougher to decipher whats going on here.
Dec 5 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: js | last post by:
I am trying to create a primary key constraint on a view in the following statement. However, I got an error ORA-00907: missing right parenthesis. If the CONSTRAINT clause is removed, then the...
3
by: M. Mehta | last post by:
It seems that you can not create a materialized view if you are using outer joins...can someone please verify this? Thanks M. Mehta Please follow my example below: created 2 tables:
4
by: Ryan | last post by:
Bit of an obscure one here, so please bear with me. I have two copies of a database which should be identical. Both have a complex view which is identical. I can open the views and the data is as...
8
by: Jef Driesen | last post by:
I'm implementing some image processing algorithms in C++. I created a class called 'image' (see declaration below), that will take care of the memory allocations and some basic (mathematical)...
4
by: Neil | last post by:
I just resolved a strange situation I was having with an ODBC linked SQL 7 view in an Access 2000 MDB file, and I'm trying to get some understanding as to what happened. The linked view was...
12
by: Neil | last post by:
I previously posted re. this, but thought I'd try again with a summary of facts. I have an Access 2000 MDB with a SQL Server 7 back end. There is a view that is linked to the database via ODBC...
10
by: Zack Sessions | last post by:
Has anyone tried to create a SQL7 view using the CREATE VIEW command and ADO.NET? If so, is there a trick in trapping a SQL error when trying to create the view? I have a VB.NET app that, amoung...
1
by: Nogusta123 | last post by:
Hi, I have had a lot of problems getting web pages, master pages and content pages to render in VS2005 design view the same as they would in Internet Explorer. I did a lot of looking on the...
6
by: Neil | last post by:
I had a strange situation with a view in SQL 7, that I could use some input on. I had a very simple view -- select a, b, c from table1 where x=y and z=q. Field a in table1 originally was varchar...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.