Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Generating test Data by Recursive SQL

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
Jimy Carol

New User


Joined: 31 Aug 2012
Posts: 25
Location: Australia

PostPosted: Thu Dec 26, 2013 3:00 pm    Post subject: Generating test Data by Recursive SQL
Reply with quote

Hello ,

I need to create massive test data for a DB2 table (more than 1 billion) with 5 columns . Is using a recursive SQL is good idea . I heard that it should not used for generating huge data. Could someone guide me as the pros and cons of using recursive SQL to genrate test data , here is the sql i am trying to use :

WITH NUMBERS (LEVEL, NEXTONE) AS
(
SELECT 1, 1
FROM SYSIBM.SYSDUMMY1
UNION ALL
SELECT LEVEL +1, LEVEL +1
FROM NUMBERS
WHERE LEVEL < 1000000
)
SELECT NEXTONE
FROM NUMBERS
ORDER BY NEXTONE


Regards
carol
Back to top
View user's profile Send private message

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7251

PostPosted: Thu Dec 26, 2013 3:41 pm    Post subject: Reply to: Generating test Data by Recursive SQL
Reply with quote

You've been posting long enough to know to use the Code tags.

Doing anything billions of times requires doing it cpu-efficiently, not source-code-efficiently. Create your data outside DB2 (SORT, IEBDG, a program) and stuff it in (not a technical expression) en masse.

Might cost you an hour of your time doing it, but will save many hours babysitting the process itself.
Back to top
View user's profile Send private message
GuyC

Senior Member


Joined: 11 Aug 2009
Posts: 1278
Location: Belgium

PostPosted: Thu Dec 26, 2013 5:30 pm    Post subject:
Reply with quote

Problem with recursive SQL or any SQL generating huge temp data is that it consumes memory or DSNDB07 space. not to mention CPU-cycles.

IEBDG + LOAD like Bill suggested

or ...
Its been a while since I tried this, but I believe you can get the same result with an sensitive dynamic cursor :
*UNTESTED*
poulate the table with a 1000 rows.
Code:

alter tablespace mytablespace not logged
open mycursor sensitive dynamic cursor for select keycolumn, datacolumn from mytable
fetch into :mykey, :mydata
perform until sqlcode <> 0 or :mykey > 100000
    insert into mytable :mykey + 1000, :mydata
    fetch into :mykey, :mydata
end-perform
close cursor
alter tablespace mytablespace logged
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Storing huge volume of data, compare ... Pradeep K M All Other Mainframe Topics 2 Mon Jan 16, 2017 5:08 pm
No new posts how to recover an uncataloged VSAM da... archanamuthukrishnan All Other Mainframe Topics 3 Wed Jan 11, 2017 6:18 pm
No new posts HALDB data refresh/copy from producti... vineetanand2007 IMS DB/DC 0 Mon Jan 02, 2017 11:16 am
No new posts JES2 JEC: Use UNIX Pipes to Pass Data... Virendra Shambharkar JCL & VSAM 21 Tue Dec 20, 2016 6:55 pm
No new posts Is the 'prompt' data for the DSLIST p... Willy Jensen TSO/ISPF 2 Tue Dec 06, 2016 4:38 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us