DNNCommunity / DNNCommunity/Dnn.CommunityForums

Use READ-ONLY SQL Queries for Select Statements

Open
#434 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
C#
Stars
18
Forks
23
Avg merge
20h 30m
Merged PRs (30d)
19

Description

## Is your feature request related to a problem?
When performing database lookups, they can be expensive in terms of performance on larger websites. In the case of display views, there's no reason to have the full power that comes with a default query.

This proposed update suggests updating all `SELECT` queries to use a read-only context. This will reduce the load on the query itself and the SQL database overall.

## Describe the solution you'd like
An elegant solution can be seen [in the most recent release of Hotcakes Commerce](https://github.com/HotcakesCommerce/hotcakes-commerce-core/pull/392).

It uses EF, but another way to do this could be to isolate the `SELECT` statements, and append `;ApplicationIntent=ReadOnly;` to the end of the connection string before executing the `SELECT`.

## Describe alternatives you've considered
None yet.

## Additional context
N/A

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.