Without an index the database reads every row to find a match. An index works like the index of a book. EXPLAIN shows how a query will run, so you can see whether an index is used.
CREATE INDEX idx_orders_product ON orders(product_id); EXPLAIN ANALYZE SELECT * FROM orders WHERE product_id = 42;