Rather the other way round. The SQL is being converted to a native database call. I would presume most query commands would be quicker than their equivalent "SQL" queries.
For tuning SQL queries you can look at the indexing of the columns in a table: select tabname, colname, colno, index_keyseq, index_order from columns where tabname='ACTLOG' TABNAME COLNAME COLNO INDEX_KEYSEQ INDEX_ORDER ------------------ ------------------ ------ ------------ ----------- ACTLOG DATE_TIME 1 1 A ACTLOG MSGNO 2 ACTLOG SEVERITY 3 ACTLOG MESSAGE 4 ACTLOG ORIGINATOR 5 ACTLOG NODENAME 6 ACTLOG OWNERNAME 7 ACTLOG SCHEDNAME 8 ACTLOG DOMAINNAME 9 ACTLOG SESSID 10 ACTLOG SERVERNAME 11 Here you can see it is only indexed on DATE_TIME. Other tables have more indexed columns. Running functions on where clause columns may well cause the query to do a full table scan anyway (not using the index.) but that's just a guess. (I notice that you are using process=1234 in your where clause, so maybe you have a later release of TSM, I'm on 5.1 and don't have that column!) Remember as well that SQL queries use the free space in your database, so make sure you have plenty if you're doing big queries. Paul. -----Original Message----- From: ADSM: Dist Stor Manager [mailto:[EMAIL PROTECTED] On Behalf Of Warren, Matthew (Retail) Sent: Friday 19 November 2004 15:55 To: [EMAIL PROTECTED] Subject: select from actlog VS query actlog performance Hello TSM'ers I'm doing some scripting that is using actlog queries fairly heavily, I have noticed that Select * from actlog where cast(date_time as date)=current_date and process=1234 Is a lot slower than Q actlog begint=-08:00 se=1234 (say, its 8am in the morning...) Although you need to be carefull you are actually getting what you want with the latter version. Is TSM doing anything internally to generate a SQL statement that works quicker than mine but gives the same/similar result? - I am assuming that internally TSM takes q actlog (and other q commands) and generates a SQL statement it then processes against the TSM DB, formatting the result to generate the query output as non-tables. Thanks, Matt. ___________________________ Disclaimer Notice __________________________ This message and any attachments are confidential and should only be read by those to whom they are addressed. If you are not the intended recipient, please contact us, delete the message from your computer and destroy any copies. Any distribution or copying without our prior permission is prohibited. Internet communications are not always secure and therefore Powergen Retail Limited does not accept legal responsibility for this message. The recipient is responsible for verifying its authenticity before acting on the contents. Any views or opinions presented are solely those of the author and do not necessarily represent those of Powergen Retail Limited. Registered addresses: Powergen Retail Limited, Westwood Way, Westwood Business Park, Coventry, CV4 8LG. Registered in England and Wales No: 3407430 Telephone +44 (0) 2476 42 4000 Fax +44 (0) 2476 42 5432 Any e-mail message from the European Central Bank (ECB) is sent in good faith but shall neither be binding nor construed as constituting a commitment by the ECB except where provided for in a written agreement. This e-mail is intended only for the use of the recipient(s) named above. Any unauthorised disclosure, use or dissemination, either in whole or in part, is prohibited. If you have received this e-mail in error, please notify the sender immediately via e-mail and delete this e-mail from your system.