Posts

Showing posts from 2016

CLR Performance Checker

CLR Profiler https://player.vimeo.com/video/51588869 http://www.codeproject.com/Articles/42721/Best-Practices-No-Detecting-NET-application-memo
Static Class  * Only 1 instance of the object is created for static classes * Static class Should be declare static keyword for declare constructor or method or variable * Can't specify access specifier for static Constructor * Static constructor should run only once. Example          public static class MyClass         {             static MyClass()             {                 Console .WriteLine( "Static Constructor" );             }             public static void SomeMethod()             {         ...

SQL Cursor

SQL Cursor Let me say one thing: DON'T use cursors. They should be your preferred way of killing the performance of an entire system. Most beginners use cursors and don't realize the performance hit they have. They use memory; they lock tables in weird ways, and they are slow. Worst of all, they defeat most of the performance optimization your DBA can do. Did you know that every FETCH being executed has about the same performance of executing a SELECT? This means that if your cursor has 10,000 records, it will execute about 10,000 SELECTs! If you can do this in a couple of SELECT, UPDATE or DELETE, it will be much faster. Beginner SQL programmers find in cursors a comfortable and familiar way of coding. Well, unfortunately this lead to bad performance. The whole purpose of SQL is specifying what you want, not how it should be done. I've once rewritten a cursor-based stored procedure and substituted some code for a pair of traditional SQL queries. The table had only...

Indexing and Pagenation in SQL

Indexing              An index can be created in a table to increase the performance of application and we can get the data more quickly and efficiently              Let’s see an example to illustrate this point suppose now we are reading book in that I need to check the information for  dbmanagement  to get this information I need to search each page of the book because I don’t know in which page that word information exists it’s time taken process. Instead of reading the each page of book to get that particular word information if I check the index of book (Glossary) it is much quicker for us to get the pages which contains the information with  dbmanagement  word. By using second method we can save lot of time and we can get information in efficient way. Example of creating SQL Index on multiple columns CREATE   INDEX  SampleIndex  ON  UserInformation   ( ...

SPJobLockType

Image
Architecture: There are 8 Servers in all.. 1 Database Server 1 Mail Server 2 Web-FrontEnds 4 App Servers (out of which one is the Central Admin and also a Web Frontend) Observation: If you take a look at the Job Status in the Operations tab of the Central Admin, we can see that some jobs are running 6 instances, some 3 and some 1 instance. The number of instances is controlled by the SPJobLockType parameter that has to be passed to your job constructor. ( For a guide to creating custom jobs refer Andrew Connell's article http://www.andrewconnell.com/blog/articles/CreatingCustomSharePointTimerJobs.aspx  ) There are 3 Locks available.. SPJobLockType.None -- if you set it none, the instance will run in all the available servers in the Farm (e.g. Application Server Timer Job) SPJobLockType.ContentDatabase – this will cause 3 instances to be running in each of the Web-Frontends. SPJobLockType.Job – this will cause only one instance of the job to run on any of the front-end ser...

Find third or nth maximum salary from salary table

Row Number : SELECT Salary , EmpName FROM ( SELECT Salary , EmpName , ROW_NUMBER () OVER ( ORDER BY Salary ) As RowNum FROM EMPLOYEE ) As A WHERE A . RowNum IN ( 2 , 3 ) Sub Query : SELECT * FROM Employee Emp1 WHERE ( N-1 ) = ( SELECT COUNT ( DISTINCT ( Emp2 . Salary )) FROM Employee Emp2 WHERE Emp2 . Salary > Emp1 . Salary ) Top Keyword : SELECT TOP 1 salary FROM ( SELECT DISTINCT TOP n salary FROM employee ORDER BY salary DESC ) a ORDER BY salary

Bind Dynamic Table in MVC

EmployeesController   public ActionResult Index()  {      return View();  }   //GET JSON Method for Get details   public JsonResult GetEmployeeDetails( int ID, string tableName)  {      JsonResult json = new JsonResult ();      DataTable dtEmployeeDetails = new DataTable ();      dtEmployeeDetails = GetDetails(tableName);      if (dtEmployeeDetails != null )      {          string returnData = GetJson(dtEmployeeDetails);          json.JsonRequestBehavior = JsonRequestBehavior .AllowGet;          json.Data = returnData;          return json;          //  return Json(returnData, JsonReq...