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 Join in SQL Query vickey_dw DB2 2 Tue Jan 17, 2017 12:15 am
This topic is locked: you cannot edit posts or make replies. MQ setup query mohitsaini Java & MQSeries 4 Sun Jan 08, 2017 1:53 am
No new posts DB2 query Using Recursion, Converting... smilewithashu2 DB2 1 Tue Jan 03, 2017 12:50 pm
No new posts BC, BCR, BRC, BRCL performance steve-myers PL/I & Assembler 0 Fri Dec 23, 2016 7:44 am
No new posts SQL query to run through list of valu... Ni3-db2 DB2 14 Wed Dec 14, 2016 9:52 am


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