I cannot figure out the fastest way to do a select on the floowing field:
f_spec tinyint not null;
It is a table of 100 000 records of products and f_spec is set only for
about 200 products.
I figure it could be done in two ways:
1) create an index on f_spec and do simple
select * from products where f_spec=1;
2) create a separate table
create table specs (
primary key (product_id)
then select ids from this table and join with the products table if needed.
What is the best way?
Also, it is often needed to know only the fact that there is any product
with f_spec set.
Is using index and doing
select id from products where f_spec=1 limit 1
will be very fast ?