Leverage A Database To Gain An Optimum Speed For Your Application

In this blog post, I will tell you some queries/ tricks to speed up your application using the power of a database. I am using Postgres and ActiveRecord rails, so all questions are related to these, but you can tell them with your database.

Recently I got some performance issues when our user base increased many folds. We did some optimization and would like to share the tips:

Note: As I am using ActiveRecord, most of the examples have ActiveRecord syntax with corresponding SQL statement

Select only required fields from the database – Not all

Most developers fail to specify the necessary columns and instead select all fields from the database, leading to performance degradation.

Let us say my User Table has 100 users.

The above query took 15.4 ms to select all columns from the table. But, the question below took only 3.3ms.

Here we are not…

Learn with fun

In this blog post, I am going to tell you some queries/ tricks to speed up your application by using the power of database. I am using postgres and activerecord rails so all queries are related to these, but you can relate it with your database.

Recently I got some performance issue when our user base increased many folds. We did some optmization and would like to share the tips:

Note: As I am using ActiveRecord most of the examples have ActiveRecord syntax with corresponding SQL statement

Select only required fields from database – Not all

Mostly developers miss to specify the required columns and instead select all fields from database which leads to performance degradation.

Let us say my User Table has 100 users

Above query took 15.4 ms as it is selecting all columns from the table. But, the query below took only 3.3ms.

Here we are not…

View original post 744 more words

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.