Hi,
  This is my way of optimizing my count(*) queries under SAPDB:
1>Select Count(*) from testtable
Takes  1:14 secs returns 240830
This is the output of explain:
TABLE SCAN                                               
RESULT IS COPIED  

Instead I use this:
2>Select Count(aNotNullColumnWithanIndex) from testtable
Takes  12 seconds returns 240830
This is the output of explain:
SINGLE INDEX COLUMN USED (INDEX SCAN)
RESULT IS COPIED             
As you can see 2 is lot faster than 1 and should always give the same result. I only 
wish that SAPDB was smart enough to do that internally.

However this can't be the way other DB's function as they are still a lot faster than 
the index scan method. Under oracle any count query (irrespective of index's on 
columns) seems to always run in under 1 sec (trying this on an ORACLE table with 
150000 records-->note that it's identical in schema to my SAPDB test table.) 
I wonder if there are any SAPDB parameters that affect performance of count queries?
Are there any other known query types that run slowly? Could really help me fix 
problems before they occur :-)
Regards,
  Ajit 

_______________________________________________
sapdb.general mailing list
[EMAIL PROTECTED]
http://listserv.sap.com/mailman/listinfo/sapdb.general

Reply via email to