Different execution times running a query I have a view on a table that has 35 million rows. When I'm selecting from the view for the first time, the execution time is about 35 seconds. When I run the query again repeatedly, it is much faster, down to about 3 seconds each time.

Is there a generic explanation of why I get different execution times in scenarios like this?
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.