SQL | NoSQL |
---|---|
Relational Databases (RDBMS) | non-relational or distributed database. |
table based databases | document based, key-value pairs |
predefined schema | dynamic schema for unstructured data. |
vertically scalable scaled by increasing the horse-power of the hardware. |
horizontally scalable scaled by increasing the databases servers. |
SQL databases are best fit for heavy duty transactional type applications, as it is more stable and promises the atomicity as well as integrity of the data. | NoSQL database are highly preferred for large data set Hbase(big data) |
An index consists of two columns
Indexes could be of two types
Some of the major reasons causing slow queries are:
Here are few methods to find slow queries for different databases:
It can done by choosing the most efficient means of executing a SQL statement.
Joins are operations in the SQL, which are used to establish connections between two or more tables in a database based on the logical relationships of the columns content of the two tables. The values of the two tables fields are familiar to one another.
Inner and Outer Joins are used to retrieve the combined data from two or more database tables, yet both operate in a different manner.
Inner Joins | Outer Joins |
---|---|
non-matching values are excluded | non-matching values are included |
Theory Inner Join -Intersection | Theory Inner Join - Union |
|
Joins are unavoidable in complex queries.
Joins also might be a reason for the slow processing of the queries causing a slow data retrieval and a slower performance.
Data to be processed for a query using Outer Joins is much more compared to Inner Joins.