Subject Re: [firebird-support] Primary Key and Index
Author Martijn Tonies
Hi,

> I've got a table "EmpCalendar" that has a primary key on two fields:
EmpNo,CalDate.
> Doing a select with
> where EmpNo = <value> and CalDate = <value>
> uses the primary key - correct?

Yes.

> As does a select with
> where EmpNo = <value>
> - still correct?

Yes.

> Should I create an additional index on CalDate, if I do frequent queries
> with
> where CalDate = <value>

Yes. The index on EmpNo/CalDate cannot be used here.


With regards,

Martijn Tonies
Database Workbench - developer tool for InterBase, Firebird & MS SQL Server.
Upscene Productions
http://www.upscene.com