Hash What? Understanding Hash Indexes

Hash indexes are an integral part of databases. If you’ve ever used a database, chances are that you have seen them in action without even realizing it.

Hash indexes differ in work from other types of indexes because they store values rather than pointers to records located on a disk. This ensures faster searching and insertion into the index. That’s why hash indexes are often used as primary keys or unique identifiers.

CodingSight - Hash What? Understanding Hash Indexes
Read More

Clustered and Non Clustered Index: 7 Top Points Explained

Indexes are speed-boosters in SQL databases. They can be clustered or non-clustered. But what does it mean and where should you apply each?

I know this feeling. I’ve been there. First-timers are often confused about which index to use on which columns. However, even experts need to think this issue through before making a decision, and different situations require different decisions. As you will see later, there are queries where a clustered index will shine compared to a non-clustered index, and vice-versa.

CodingSight - Clustered and Non-Clustered Index: 7 Top Points Explained
Read More

Renaming Indexes with sp_rename Procedure

Not so long ago, I was working on a project where we needed to change the data type of a table. The table had millions of rows, and we decided to create a separate table using the existing table definition and insert the rows into that table. After exporting data into the new table, we renamed the old table, constraint, and indexes using the sp_rename stored procedure.

The current article is dedicated to the ways of renaming indexes. You can also read how to rename table in SQL.

CodingSight - Renaming Indexes with sp_rename Procedure
Read More

Create a Database Diagram Using dbForge Database ER Diagram Tool for SQL Server

SQL Server database diagram is a graphical representation of database tables. It visualizes the database structure and allows you to understand the overall database schema and relations. It lets you also manage the database schema from the diagram page by creating and modifying database tables, columns, dependencies, indexes, constraints, and keys.

Read More

SQL Server Indexes Management Using Index Manager for SQL Server

SQL Server Index Overview

When talking about SQL Server performance tuning and queries enhancement, the first thing to consider is the SQL Server Index. It serves to accelerate reading data from underlying tables by providing quick access to the requested rows. Thus, it won’t need to scan all the table’s records.

The SQL Server index provides those fast search capabilities due to the B-Tree structure of the index. This structure makes it possible to move through the table rows based on the index key quickly and retrieve the requested records at once. It won’t need to read the whole table.

Read More

Tutorial on SQL (DDL, DML) on the example of MS SQL Server dialect

Introduction

This tutorial includes information about SQL (DDL, DML) that I have gathered during my professional life. This is the minimum you need to know while working with databases. If there is a need to use complex SQL constructions, then usually I surf the MSDN library, which can be easily found on the internet. To my mind, it is very difficult to keep everything in your head and, by the way, there is no need for this. I recommend that you should know all the main constructions used in most relational databases such as Oracle, MySQL, and Firebird. Still, they may differ in data types. For example, to create objects (tables, constraints, indexes, etc.), you may simply use integrated development environment (IDE) to work with databases and there is no need in studying visual tools for a particular database type (MS SQL, Oracle, MySQL, Firebird, etc.). This is convenient because you can see the whole text, and you do not need to look through numerous tabs to create, for example, an index or a constraint. If you are constantly working with databases, creating, modifying, and especially rebuilding an object using scripts is much faster than in a visual mode. Besides, in my opinion, in the script mode (with due precision), it is easier to specify and control rules for naming objects. In addition, it is convenient to use scripts when you need to transfer database changes from a test database to a production database. Read More

Query Store: Showing the Impact of Indexes on Inserts

Introduction

It is common knowledge in database circles that indexes improve query performance either by satisfying the required result set entirely (Covering Indexes) or acting as lookups which easily direct the Query Engine to the exact location of the required data set. However, as experienced DBAs know, one should not be too enthusiastic about creating indexes in OLTP environments without understanding the nature of the workload. Using Query Store in SQL Server 2019 instance (Query Store was introduced in SQL Server 2016), it is quite easy to show the effect of an index on inserts. Read More