View previous topic :: View next topic
|
Author |
Message |
rahul_desai29
New User
Joined: 15 Mar 2006 Posts: 10 Location: fl;jds
|
|
|
|
SELECT * it is running very slow,how you will make it faster? |
|
Back to top |
|
|
priyesh.agrawal
Senior Member
Joined: 28 Mar 2005 Posts: 1448 Location: Chicago, IL
|
|
|
|
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 |
|
|
KS
New User
Joined: 28 Feb 2006 Posts: 91 Location: Chennai
|
|
|
|
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 |
|
|
Gautam512
Active User
Joined: 05 Oct 2005 Posts: 308 Location: Vizag / US
|
|
|
|
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 |
|
|
priyesh.agrawal
Senior Member
Joined: 28 Mar 2005 Posts: 1448 Location: Chicago, IL
|
|
|
|
You may also want to code "FOR FETCH ONLY" to improve preformance, in case your query is read-only.
Regards,
Priyesh. |
|
Back to top |
|
|
|