If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Refresh User Maintained MQT

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-16-09, 13:19
xtomx xtomx is offline
Registered User
 
Join Date: Sep 2009
Posts: 7
Refresh User Maintained MQT

Hi guys,

first of all: Hi, this is Tom and I just registered here

I've got a problem with MQTs here.

I am trying to union 2 tables into 1 MQT (2-3 million rows). Using system maintained MQTs with REFRESH is pretty slow so I was changing the MQT to user defined.

Now I would need to use REFRESH in some cases where a manual update would be too complex, so I use in

case 1) DELETE and INSERT (which works)
case 2) REFRESH - but this doesnt work for USER MAINTAINED MQTs

What is the alternative for REFRESH? I tried LOAD but I cant manage to define a LOAD statement for an MQT called "test" which than contains the data like

select * from table_a union select * from table_b

How would that work?

Thanks a lot and regards,
Tom
Reply With Quote
  #2 (permalink)  
Old 09-16-09, 13:40
dav1mo dav1mo is offline
Registered User
 
Join Date: Dec 2007
Location: Richmond, VA
Posts: 782
Tom,
You don't mention which platform and version you are running on. For Z/OS, the command is
Quote:
"REFRESH TABLE tablename".
As far as a load goes you would perform just like any other load. If you are on LUW, you can check the SQL reference for the exact command.
Reply With Quote
  #3 (permalink)  
Old 09-16-09, 13:43
xtomx xtomx is offline
Registered User
 
Join Date: Sep 2009
Posts: 7
Hi,

its DB/2 on UNIX.

REFRESH does not work on User Maintained MQTs.

I cant figure out how to use LOAD to just copy data from table 1 to table 2 (both have the same types of columns)

Thanks,
Thomas
Reply With Quote
  #4 (permalink)  
Old 09-16-09, 14:10
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
Quote:
Originally Posted by xtomx
I cant figure out how to use LOAD to just copy data from table 1 to table 2 (both have the same types of columns)
Code:
declare c1 cursor for select whatever from table1;
load from c1 of cursor replace into table2;
Reply With Quote
  #5 (permalink)  
Old 09-17-09, 05:34
xtomx xtomx is offline
Registered User
 
Join Date: Sep 2009
Posts: 7
Great! Thanks a lot!

Now I used

declare c1 cursor for select * from myschema.t_table

and what I get is the error

AN unexpected token "declare c1 cursor for select * from myschema." was found following "BEGIN-OF-STATEMENT". Expected tokens may include: "<space>".

What exactly is wrong here?

Thanks a lot,
Tom
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On