Legora interview question

How do postgresql indexes work and how do they change the query speeds?