How to write SQL query without creating performance issues or locks on tables?
Writing simple sql query without affecting performance issues is not possible in simple way. Better approach to deal with these type of issues is using ISOLATION LEVEL in sql. For exselect col1,col2 from tableAbove query will put read commit lock on table untill finished.Better approach to handle this (if selection of data is only priority)set transaction isolation level read uncommitted select col1,col2 from table; commit;please read https://docs.microsoft.com/en-us/sql/t-sql/statements/set-transaction-isolation-level-transact-sql?view=sql-server-ver15
select col1,col2 from table
set transaction isolation level read uncommitted select col1,col2 from table; commit;