‎2007 Jul 17 1:58 AM
hi gurus,
my select statement below is taking around 15 sec to execute, need your help in this regard.
select single * from tablename where no = itab-no.
Thanks,
vj
‎2007 Jul 17 3:51 AM
Hi Vijay,
The most costly statement is select statement, so you should take precautions to use it.
In your case though you are not providing the whole statement, What i can suggest you is
1. Instead of select * , select only the filelds required in the order they are there in the table.
2. In the where clause if possible give the entire primary key in the same order as it is there in the table.
3. If you are using fields other than primary key, create a secondary index.
Reward points if useful,
Aleem.
‎2007 Jul 17 2:00 AM
Hi Vijay,
Can you jsut paste the correct code.
And also as this is select single and if you are having the whole key in where clause then it is the fastest, but if you don't have the whole key then do not use SELECT single instead use SELECT UPTO 1 ROWS.
Regards,
Atish
‎2007 Jul 17 2:15 AM
hi atish,
SELECT SINGLE * FROM VIQMEL WHERE EQFNR = ITAB-AUFNR..
‎2007 Jul 17 3:40 AM
You can try with select upto one row..
SELECT * FROM VIQMEL into VIQMEL up to 1 row
WHERE EQFNR = ITAB-AUFNR..
when you use select single on databse view ,that to you are selecting the all fields,the field EQFNR it may have many same records,so use select upto 1 row.
check the below link :
http://help.sap.com/saphelp_nw04s/helpdata/en/a5/298aa13dae11d3a98200a0c9449261/frameset.htm
Thanks
Seshu
‎2007 Jul 17 3:51 AM
Hi Vijay,
The most costly statement is select statement, so you should take precautions to use it.
In your case though you are not providing the whole statement, What i can suggest you is
1. Instead of select * , select only the filelds required in the order they are there in the table.
2. In the where clause if possible give the entire primary key in the same order as it is there in the table.
3. If you are using fields other than primary key, create a secondary index.
Reward points if useful,
Aleem.
‎2007 Jul 17 4:53 AM
VIQMEL is not a table itself - it is a view of tables QMIH, QMEL and ILOA.
the field you are searching on (EQFNR) is a non-key field on table ILOA which is not an index field either.
This will be very slow depending on the size of the tables.
Is there any other data you can use to search by? perhaps it would be quicker to get extra key data for this view by reading some other tables first?
If not, you may need to add an index to ILOA for this field - I would check with SAP as adding indexes to standard tables such as this which already appears to have several indexes may have unforseen impacts on standard processing. Generally it is all right, but an extra index for the system to maintain can cause problems sometimes.
‎2007 Jul 23 9:31 AM