BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
JohnT
Quartz | Level 8

Hi,

We are in the midst of migrating SAS code into DI Studio.

I have a job which creates some indexes at the end.

  

I have tried to do this in DI Studio, without using user written code.

When I run the job in DI Studio without indexes, it takes 20 seconds to run.  With indexes (it's still running but it's now over seven minutes).  I set the properties of the table to have indexes. 

   /*---- Create the indexes for a table  ----*/
   %put %str(NOTE: Creating indexes ...);
   proc datasets lib = NS nolist;
      modify POLICY_HISTORY;
         index create insurance_ref;
         index create insurance_file_cnt;
         index create p_key = (insurance_ref policy_version);
   quit;
  
   %rcSet(&syserr);
  
%end;  /* if table does not exist  */

/*---- Append  ----*/
%put %str(NOTE: Appending data ...);

proc append base = NS.POLICY_HISTORY
            data = &etls_lastTable (&etls_tableOptions) force;
run;


^^
I think the reason it takes so long to run now, is because it applies the indexes to an empty dataset, and then appends the data to it.  I don't care about the append part, but I think the table loader transform does this by default.  I tried the SQL insert, and it still took ages.

I want the metadata to be meaningful, so in my head, the indexes need to be on the output table.

I guess, I could have some user written code at the end of the job which puts the indexes on, but then the metadata wouldn't tell people it's there.

So, what's the right way for me to apply these indexes.

I'm running DI Studio 4.21 on a Windows bases server.

Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
LinusH
Tourmaline | Level 20

In the Table Loader, you have the opportunity to specify whether you want the index to be built before or after table creation/update.

See "Index Condition", and refer to the Help section to chose the appropriate settings for your scenario.

Br

Linus

Data never sleeps

View solution in original post

2 REPLIES 2
LinusH
Tourmaline | Level 20

In the Table Loader, you have the opportunity to specify whether you want the index to be built before or after table creation/update.

See "Index Condition", and refer to the Help section to chose the appropriate settings for your scenario.

Br

Linus

Data never sleeps
JohnT
Quartz | Level 8

Thanks for the suggestion LinusH, I think that's what I was after.

I would have expected to see this option on the output table, and not on the transform though?

I'll try it and see how it goes.

Thanks again.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to connect to databases in SAS Viya

Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 2314 views
  • 0 likes
  • 2 in conversation