Home > Ask the SQL Server Experts > Jeremy Kadlec - Performance Tuning Questions & Answers > What's the best way to page SQL Server data results?
Ask The SQL Server Expert: Questions & Answers
EMAIL THIS

What's the best way to page SQL Server data results?

Jeremy Kadlec EXPERT RESPONSE FROM: Jeremy Kadlec

Pose a Question
Other SQL Server Categories
Meet all SQL Server Experts
Become an Expert for this site


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


>
QUESTION POSED ON: 27 December 2005
My question is regarding paging SQL Server data results. I am using PHP with SQL Server. For a specific search I have nearly 500 records. I am displaying 50 results per page and providing PREV and NEXT option for paging. In order to fetch the second set of results (for page 2), what I am doing is running the query again (fetching the whole 500 records) and just filtering the first 50 records inside the script and start displaying records from 50 to 100. I know this is not the best way to do it. Could you please suggest a better solution for this? Also, is it Ok to query the database for each page? At the same time, my query involves joins with 3 tables. Please help me on this.

>
EXPERT RESPONSE
I am not familiar with PHP but look into the record set options. I know with the latest build of ADO.NET, many options are available to cache the record set and only traverse the record sets that are needed and then query SQL Server for the needed data.


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


RELATED CONTENT
Jeremy Kadlec - Performance Tuning
View query execution plan in SQL Server with this method
Adding non-clustered indexes to SQL Server columns
Change collation to SQL Server 2005 after upgrading databases
Is my SQL Server 2000 optimized?
What impact does changing one record have on the database?
Is there a maximum number of sockets that SQL can handle?
Why is my SQL Server frequently corrupted?
How to speed up a composite nonclustered index-based query
Can I change the date format when moving a flat file to SQL?
Performance differences between Windows and Linux-based databases

SQL Server performance and tuning
How to create a SQL Server linked server to DB2
Using full-text search for symbols in SQL Server
Monitor database mirroring and replication after a SQL Server upgrade
How to use the SELECT statement in SQL
Translating information requests into SQL SELECT statements
Using DISTINCT in SQL to eliminate duplicate rows
SQL SELECT statement and SELECT query samples
Using the ORDER BY clause of the SELECT query in SQL
How to configure Database Mail in SQL Server 2005 to send mail
SQL Server stored procedures tutorial: Write, tune and get examples

RELATED GLOSSARY TERMS
Terms from Whatis.com − the technology online dictionary
contiguity  (SearchSQLServer.com)
contiguous  (SearchSQLServer.com)
drilldown  (SearchSQLServer.com)
hashing  (SearchSQLServer.com)
hybrid online analytical processing  (SearchSQLServer.com)

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary



Search and Browse the Expert Answer Center
Search and browse more than 25,000 question and answer pairs from more than 250 TechTarget industry experts.
Browse our Expert Advice

HomeNewsTopicsITKnowledge ExchangeTipsAsk the ExpertsMultimediaWhite PapersIT Downloads
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides enterprise IT professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective IT purchase decisions and managing their organizations' IT projects - with its network of technology-specific Web sites, events and magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Reprints  |  Site Map




All Rights Reserved, Copyright 2005 - 2008, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts