If a table contains 20000 records . In a page at each time
100 records to be displayed. What are the steps u will take
to improve performance? will you use dataset or datareader?
Answer Posted / renjith t n
You need to look at ROW_NUMBER() to do this effectively.
Temp tables, cursors are to costly.
CREATE PROCEDURE myProc
@StartIndex INT
@MaxRecords INT
AS
SET @StartIndex = @StartIndex + 1
SELECT
first_name,
last_name,
middle_init
FROM
(SELECT
first_name,
last_name,
middle_init
ROW_NUMBER() OVER(ORDER BY last_name)
AS rownum
FROM
Users)
AS Users
WHERE
rownum between @StartIndex and (@StartIndex + @MaxRecords) -
1
Then we can use Dataset for best performance..
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
If we are not returning any records from the database, which method is to be used?
Define atomicity?
Explain the advantage of ADO.Net?
Which parameter of ConnectionString is used to specify the name of the database?
How do you connect to sql server database without using sqlclient?
What are disadvantages of microsoft-provided data provider classes in ado.net?
What is disconnected scenario in entity framework?
What is partial class?
Explain how to bind the controls(best practice) comboboxes to the data in the dataset?
Explain the DataAdapter.Update() and DataSetAcceptChanges() methods.
Define table relations?
What is the role of the dataset object in ado.net?
Explain the basic use of "dataview" and explain its methods.
What are the steps you will take to improve performance?
What is difference between sqldatareader and sqldataadapter?