I have the following table
CompanyId int(2) Primary key
CustomerId char(20) Primary key
This table has more than 8989998788 records
I am using the below where condition to fetch the records
select customerId , SaleDate,SalesAmount from Customer_sales
where CustomerId >'12345'
and CustomerId <'879999'
Should I have to include the CompanyId in the where condition since it is a composite primary key ? Will this improve the query performance ?
And, Does where clause in the same order how the composite primary key builded ?
(ie) where CompanyId =12 and CustomerId >'12345'