Many factors affect performance. Some are beyond your control, but thoughtful design of your application and the configuration of the database middleware that connects your application to the database server can result in optimal performance.
If you are going to design only one aspect of your application, let it be database connections, which are performance-expensive. Establishing a connection can take up to ten network round trips. You should assess whether connection pooling or one connection at a time is more appropriate for your situation.
When designing your database application, here are some important questions to ask: Are you retrieving only the minimum amount of data that you need? Are you retrieving the most efficient data type? Would a prepared statement save you some overhead? Could you use a local transaction instead of a more performance-expensive distributed transaction?
Lastly, make sure that you are using the best database driver for your application. Does your database driver support all the functionality that you want to use in your application? For example, does your driver support statement pooling? Does the driver have runtime performance tuning options that you can configure to improve performance? For example, can you configure the driver to reduce network activity?