Different execution times running a query
All operating systems and all applications use a concept called "caching". 

It means - when the data is first read from a slow memory device (like, a hard disk), it is saved in a fast memory device (like, RAM) for some time, to facilitate faster lookups.

The same applies to RDBMS.

First time the data blocks that build up your query results are read from disk, second time they are read from memory.

Details can be explored using OS and database tools. If you specify what RDBMS and what OS you are on, we can help you get the details. For PostgreSQL it's about EXPLAIN command.