Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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 HEX value search in a DB2 query maxsubrat DB2 2 Wed Oct 04, 2017 3:04 pm
No new posts Create procedure issues -628 when add... chandraBE DB2 1 Mon Sep 18, 2017 12:16 pm
No new posts Can we limit length in concatenation ... balaji81_k DB2 7 Tue Aug 22, 2017 2:50 am
No new posts Select numeric portion from CHAR data... balaji81_k DB2 6 Sat Aug 19, 2017 1:51 am
No new posts SQL - select data available in index Nileshkul DB2 3 Mon Jun 26, 2017 1:30 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us