Jason Louder wrote:

> I need some help with indexes. I've created a table and index.
>
> create table test(
> id serial,
> name varchar(20),
> primary key(id)
> )
>
> create index indexName on test(name)
> update statistics test
>
> and when I tried explain select name from test where name = 'blah'.
> it gave me 'table scan', while I'm expecting an index lookup.
> What could be the cause ?
>
> And also I'm using 7.4, what database parameters are important for optimization ?


SAP DB used a costbased optimizer. 
So the optimizer seems to calculate less costs for 
the tablescan than for the index access in your case.
This could be true if there is no or only few data in table test.
Or 'blah' is a very frequently used name in test.
"select * from optimizerstatistics where tablename = 'TEST'" 
should show you wich reason is true for you.

Kind regards,
Holger
SAP Labs Berlin
_______________________________________________
sapdb.general mailing list
[EMAIL PROTECTED]
http://listserv.sap.com/mailman/listinfo/sapdb.general

Reply via email to