IEnumerable Vs IQueryable

C# Basic, MVC

Differences between them based on their properties :

IEnumerable

  1. NamespaceSystem.Collections Namespace
  2. Derives from: No base interface
  3. Deferred Execution : Supported
  4. Lazy Loading : Not Supported
  5. How does it work : While querying data from database, IEnumerable execute select query on server side, load data in-memory on client side and then filter data. Hence does more work and becomes slow.
  6. Suitable for : LINQ to Object and LINQ to XML queries.
  7. Custom Query : Doesn’t supports.
  8. Extension method parameter : Extension methods supported in IEnumerable takes functional objects.
  9. When to use : When querying data from in-memory collections like List, Array etc.
  10. Best Uses : In-memory traversal

Continue reading “IEnumerable Vs IQueryable”

List few advantages of Stored Procedure.

QA-SQL Server
  • Stored procedure can reduced network traffic and latency, boosting application performance.
  • Stored procedure execution plans can be reused, staying cached in SQL Server’s memory, reducing server overhead.
  • Stored procedures help promote code reuse.
  • Stored procedures can encapsulate logic. You can change stored procedure code without affecting clients.
  • Stored procedures provide better security to your data.

What is Cross Join?

QA-SQL Server

A cross join that does not have a WHERE clause produces the Cartesian product of the tables involved in the join. The size of a Cartesian product result set is the number of rows in the first table multiplied by the number of rows in the second table.

The common example is when company wants to combine each product with a pricing table to analyze each product at each price.

What is Self Join?

QA-SQL Server

This is a particular case when one table joins to itself, with one or two aliases to avoid confusion. A self join can be of any type, as long as the joined tables are the same.

A self join is rather unique in that it involves a relationship with only one table. The common example is when company have a hierarchal reporting structure whereby one member of staff reports to another.

What is a Scheduled Jobs/Tasks?

QA-SQL Server

Scheduled tasks let user automate processes that run on regular or predictable cycles. User can schedule administrative tasks, such as cube processing, to run during times of slow business activity. User can also determine the order in which tasks run by creating job steps within a SQL Server Agent job.

E.g. Back up database, Update Stats of Tables. Job steps give user control over flow of execution. If one job fails, user can configure SQL Server Agent to continue to run the remaining tasks or to stop execution.