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
 

 

Improve the performance of SELECT query

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

New User


Joined: 15 Mar 2006
Posts: 10
Location: fl;jds

PostPosted: Tue Mar 21, 2006 11:55 am    Post subject: Improve the performance of SELECT query
Reply with quote



SELECT * it is running very slow,how you will make it faster?
Back to top
View user's profile Send private message

priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1452
Location: Chicago, IL

PostPosted: Tue Mar 21, 2006 12:58 pm    Post subject: Re: Improve the performance of SELECT query
Reply with quote

Quote:
SELECT * it is running very slow,how you will make it faster?

By coding only your columns of interest.

Regards,
Priyesh.
Back to top
View user's profile Send private message
KS

New User


Joined: 28 Feb 2006
Posts: 91
Location: Chennai

PostPosted: Wed Mar 22, 2006 12:14 pm    Post subject:
Reply with quote

Hi,
It is not the correct standard to give a select a query with *.This statement will result in excessive I/O overhead.
1. Instead of '*' , give the column names on which u need to select
2. Give necessary where clause
3. If u r tring to fetch rows from a larger db , thenuse FETCH FIRST 100 ROWS ONLY;
ex-
SELECT TRANS_NO , ST_DATE FROM EMPLOYEE.TABLE1
WHERE TRANS_NO = 7458959
ORDER BY TRANS_NO DESC
FETCH FIRST 100 ROWS ONLY ;

Thanks,
Ks
Back to top
View user's profile Send private message
Gautam512

Active User


Joined: 05 Oct 2005
Posts: 309
Location: Vizag / US

PostPosted: Wed Mar 22, 2006 3:47 pm    Post subject: Re: Improve the performance of SELECT query
Reply with quote

i totally accept what KuttiSatha said,

Select * always increases the I/O overhead.

Better to give the required column names.

One more important thing which increases the efficiency is,

for every column in a table there will be assigned indices (order of preference) if u use the same order for the column selected in the select query u'll surely increase the efficiency.
Back to top
View user's profile Send private message
priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1452
Location: Chicago, IL

PostPosted: Wed Mar 22, 2006 4:15 pm    Post subject: Re: Improve the performance of SELECT query
Reply with quote

You may also want to code "FOR FETCH ONLY" to improve preformance, in case your query is read-only.

Regards,
Priyesh.
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 JCL to Set Return code based on DB2 S... vinu78 DB2 17 Mon Mar 13, 2017 9:47 pm
No new posts SQL query not working in Cobol program. CuriousMainframer COBOL Programming 14 Wed Feb 22, 2017 5:56 pm
No new posts Omegamon for DB2 query ashek15 DB2 0 Wed Feb 15, 2017 11:25 am
No new posts Query on DB2 WLM stored procedures ashek15 DB2 8 Sun Feb 12, 2017 11:13 pm
No new posts GETMAIN/FREEMAIN query Suja.Sai CICS 9 Tue Jan 31, 2017 12:01 pm


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