Ravindra Devrani

Let's build and grow together...


Ravindra Devrani

Learn how to use azure key vault with .net to override appsettings in production.

ravindradevrani.com/posts/azure-key-vault-with-dot…

3 months ago | [YT] | 3

Ravindra Devrani

Azure App Configuration

- Azure `App Configuration` is a fully managed service, which provides you a way to store the configurations in a centralized store. You can store configurations of multiple apps in a single place.
- It is really helpful for cloud native application (eg. Microservices), which runs on multiple virtual machines and use multiple external services.

Read more about this here : ravindradevrani.com/posts/azure-app-configuration-…

3 months ago | [YT] | 4

Ravindra Devrani

Azure Blob Storage : CRUD With AspNetCore Mvc & SQL Server

Azure blob storage is a storage solution provided by microsoft. You can store data like images, audio, video, json files, zip files etc etc in the azure.

What are we going to learn?


- How to create a web application that stores and manipulate the images in the cloud.

- We will perform all the CRUD (create, read, update and delete) operations.
ravindradevrani.com/posts/blob-storage-with-dotnet…

Read complete blog po
st here: ravindradevrani.com/posts/blob-storage-with-dotnet…

#dotnet #aspnetcore #csharp #azure

4 months ago (edited) | [YT] | 3

Ravindra Devrani

Azure Cosmos DB For NoSQL - CRUD With Dotnet

Azure Cosmos DB for NoSQL is a fully managed and serverless NoSQL and vector database for modern app development, including AI applications and agents. With its SLA-backed speed and availability as well as instant dynamic scalability, it is ideal for real-time NoSQL applications that require high performance and distributed computing over massive volumes of NoSQL and vector data.

Read full article here:

ravindradevrani.com/posts/cosmos-db-crud-with-dotn…


#dotnet #aspnetcore #azure #csharp

4 months ago (edited) | [YT] | 4

Ravindra Devrani

** Compound or Composite index in sql server **

- Created on two or more columns of the table.

```
create index IX_Book_Book_Title_Author
on Book2 (Title,Author)
```

- Data is organized based on `Title` and `Author`

- This index will help queries that:
- Filter by `Title` only
- Filter by `Title` AND `Author`

- But it will NOT help queries that:
- Filter by `Author` only (without Title)

Here is the full article: ravindradevrani.com/posts/covering-indexes/

10 months ago (edited) | [YT] | 2

Ravindra Devrani

SQL TIP: stop using this condition in your query

`where some_column=@some_parameter or @some_parameter is NULL`

It does not use the index of `some_column` and leads to full table scan.

Example :

create or alter procedure GetBooks
@SearchTerm nvarchar(40)=null
as
begin
set nocount on;

select * from Book
where @SearchTerm is null or Title like @SearchTerm+'%';
end
go

-- execute the procedure
exec GetBooks @SearchTerm='The Epic Of Gilgamesh'; -- return 1 row

This query causes the full table scan.

You can solve it with:

1- Dynamic SQL
2- OPTION (RECOMPILE)

I have written an article and include previous community post on sql tip. You can find the solution using dynamic sql and option(recompile) there.

You can check this out:

ravindradevrani.medium.com/what-makes-your-query-n…

11 months ago | [YT] | 2

Ravindra Devrani

SQL Tip: Avoid using implicit conversions.

When we compare two values with different data types, the sql server converts the lower-precedence data type to higher-precedence data type. Let's look at the example below:

-- Note: Note: `CardNumber` is `nvarchar`, there is an index on the `CardNumber` and we are comparing it with an integer 11119775847802


SELECT
CreditCardID,
CardNumber
FROM Sales.CreditCard
WHERE CardNumber = 11119775847802;

Here `CardNumber` is a type of `nvarchar` and we are comparing it with an `integer`. `CardNumber` has an index. There is only one record with CardNumber=11119775847802, so it should read only 1 row to fetch the record. But that won't happen. Sql server database engine reads all the rows to find this record. You wonder why? Ok let me explain.

`CardNumber` is a `nvarchar` type, we are searching for a record : 11119775847802 which is an integer type. Instead of converting 11119775847802 to the `nvarchar`, the SQL Server converts all `CardNumber` rows to an integer, leading to index scan. Are you getting the problem here. We just need a single record, whose CardNumber is 11119775847802, for that the whole table is being scanned.

So, instead of 11119775847802, use '11119775847802', which avoids implicit conversion in a table side, as show below:

SELECT



CreditCardID,
CardNumber
FROM Sales.CreditCard
WHERE CardNumber = '11119775847802';

This query will read 1 row only and use the index effectively.

11 months ago (edited) | [YT] | 4

Ravindra Devrani

SQL Tip: Don't use `WHERE field LIKE '%search_term%'` unless you really need it. It would not use index on the field. It would be problematic, if you have a table with large record set. Let's look at the example

Note: The 'Book' table have 999996 records, and it has a non-clustered index on the column 'Title'.

Query 1:

SELECT
b.*
FROM Book b
WHERE b.Title Like '%fairy%';

This query Won't use the index. It Performs 'index scan' and read all 999996 rows (whole 'Book' table).

Query 2:

SELECT
b.*
FROM Book b
WHERE b.Title Like 'fairy%';

This query will use 'index seek' and read only 1 row. Since we have only one record that starts with the text 'fairy'.

11 months ago | [YT] | 4

Ravindra Devrani

SQL Tip: Never put a column inside a function in the where clause.

A query is a `SARGable` (SEARCH ARGUMENTable) if it can take advantage of the index.



If you Include a column name inside a function in the `where` clause, it will make your query non SARGable. Even that column has an index. Let's look at the image to understand it more.

11 months ago | [YT] | 3