views:

48

answers:

2

Is there a way to fetch 4 million records from SQL Server 2005 in under 60 seconds?

My table consists of 15 columns. Each has datatype of varchar(100) and there is no primary key.

+2  A: 

Assuming you want the entire contents of the table then try this first:

SELECT col1, col2, ... col15 FROM your_table

If that is too slow then there's not really anything more you can do apart from change your program design so that it is not necessary to fetch so many rows at once.

If this records will be displayed in a graphical user interface you could consider using paging instead of fetching all the rows at once.

Mark Byers
I just **love** grids with 4 million rows in them - makes scrolling such fun!!
marc_s
:-) yeah..more fun when you scroll when the rows are still being fetched..:-)
ydobonmai
A: 

Actually last time I did something like this, i put a filter dropdown and then the records would be filtered using the filter user selects. I also give the option "All" in the dropdown selecting which I show the user a message like "Retrieving all records will be bit slow. Want to continue?". And in any case, as Mark suggested, I used paging .

ydobonmai