Why does a database action often take far longer when it is first executed than in subsequent executions?
The longer runtime is mostly triggered by required data pages being imported by the hard disk (I/O). With the following accesses, the pages are already in the data cache, which may significantly reduce the runtime. You can analyze this behavior by using the command monitor and the Database Analyzer. If the access to a table is not optimal, too many data pages are loaded into the cache and other data is displaced from the cache. This then leads to poor data cache hitrates and to many I/O accesses to the hard disk, which can be removed by appropriate tuning measures (increasing the data cache, creating suitable indexes, and so on) after a thorough performance analysis. See also Note 819324 FAQ MaxDB: SQL optimization.