Raimund Jacob wrote

> i created a table with 2 FIXED values as primary key and a column
> VARCHAR(512).
> EXPLAIN tells me that "select * " where that varchar is 'foo' 
> results in
> a table scan (!) although i created an index on that column. "select
> count(*)" with the same condition is a "EQUAL CONDITION FOR INDEXED
> COLUMN", resulting in a much lower cost value.
> 
> is the explain statement not telling the truth? shouldnt it 
> use the same
> strategy when selecting * ?
> this is kernel 7.3.0.20 via JDBC...

For "select count(*)" the optimizer could use an index only strategy, 
this is indicated by an asterisk within the 'O' column of the explain
output.
For "select *" the basetable have to be read additionaly for the columns 
not included in the index and it seems that the optimizer have decided that 
in this case it's better to scan the table.

Kind regards,
Holger

SAP Labs Berlin 

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

Reply via email to