Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > DataGrid paging - a question of efficiency

Reply
Thread Tools

DataGrid paging - a question of efficiency

 
 
Shawn
Guest
Posts: n/a
 
      02-13-2005
Hi.

I already have a datagrid where I'm using paging. I have a stored procedure
that fills a temp table with 200-500 rows and then sends back 10 records at
the time. When I go to page 2 the SP fills the temp table again and returns
rows 10-19. The temp table is dropped after each call to the SP, so it has
to be created and filled every time the user changes page in the datagrid.
My question is this: Would it be more efficient to return all rows to the
datagrid and set the visibility on each datagriditem instead? After the
datagrid is filled up I could hide all but the 10 first datagrid items, and
when the user changes to page 2 I could set only datagrid items 10-19
visible etc. I have read quite a lot about custom paging, but I have never
read anything about this approach therefore I'm interested in what you
experts have to say. Is it a good idea?



Thanks,

Shawn


 
Reply With Quote
 
 
 
 
Scott M.
Guest
Posts: n/a
 
      02-13-2005
Why are you re-creating and re-populating the temp table on each page
request? Why not store this data in ViewState or the Cache or some other
medium? The only time you should be going back to the database is on the
first page load unless you want to use custom paging and you are going to
the db on each page call, but only bringing down 1 page worth of data.



"Shawn" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi.
>
> I already have a datagrid where I'm using paging. I have a stored
> procedure
> that fills a temp table with 200-500 rows and then sends back 10 records
> at
> the time. When I go to page 2 the SP fills the temp table again and
> returns
> rows 10-19. The temp table is dropped after each call to the SP, so it
> has
> to be created and filled every time the user changes page in the datagrid.
> My question is this: Would it be more efficient to return all rows to the
> datagrid and set the visibility on each datagriditem instead? After the
> datagrid is filled up I could hide all but the 10 first datagrid items,
> and
> when the user changes to page 2 I could set only datagrid items 10-19
> visible etc. I have read quite a lot about custom paging, but I have
> never
> read anything about this approach therefore I'm interested in what you
> experts have to say. Is it a good idea?
>
>
>
> Thanks,
>
> Shawn
>
>



 
Reply With Quote
 
 
 
 
Shawn
Guest
Posts: n/a
 
      02-13-2005
> Why are you re-creating and re-populating the temp table on each page
> request?

The temp table is created by my stored procedure. When the stored procedure
has finished all temp tables cerated by that SP are automatically dropped by
sybase.

> Why not store this data in ViewState or the Cache or some other
> medium?

Thats exactly what I'm considering. Return all rows from the SP (not just
10 and 10), fill the datagrid with all of them, but only show 10 rows at the
time. That way all rows would all be stored in ViewState.

> The only time you should be going back to the database is on the
> first page load unless you want to use custom paging and you are going to
> the db on each page call, but only bringing down 1 page worth of data.

Didn't you read what I wrote? I am using custom paging. I am returning to
the db (SP) on each page call and bringing back 1 page (10 rows) of data.

Shawn

"Scott M." <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Why are you re-creating and re-populating the temp table on each page
> request? Why not store this data in ViewState or the Cache or some other
> medium? The only time you should be going back to the database is on the
> first page load unless you want to use custom paging and you are going to
> the db on each page call, but only bringing down 1 page worth of data.
>
>
>
> "Shawn" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Hi.
> >
> > I already have a datagrid where I'm using paging. I have a stored
> > procedure
> > that fills a temp table with 200-500 rows and then sends back 10 records
> > at
> > the time. When I go to page 2 the SP fills the temp table again and
> > returns
> > rows 10-19. The temp table is dropped after each call to the SP, so it
> > has
> > to be created and filled every time the user changes page in the

datagrid.
> > My question is this: Would it be more efficient to return all rows to

the
> > datagrid and set the visibility on each datagriditem instead? After the
> > datagrid is filled up I could hide all but the 10 first datagrid items,
> > and
> > when the user changes to page 2 I could set only datagrid items 10-19
> > visible etc. I have read quite a lot about custom paging, but I have
> > never
> > read anything about this approach therefore I'm interested in what you
> > experts have to say. Is it a good idea?
> >
> >
> >
> > Thanks,
> >
> > Shawn
> >
> >

>
>



 
Reply With Quote
 
=?Utf-8?B?S2F1c3Rhdg==?=
Guest
Posts: n/a
 
      02-13-2005
Hi Shawn,

creating temp tables is not an ideal solution. You would be better off using
derived tables as compared to temp tables. How about specifying the number of
records to be fetched in the Fill method of the DataAdapter when you change
the page of the datagrid.

HTH.

Kaustav Neogy.

"Shawn" wrote:

> Hi.
>
> I already have a datagrid where I'm using paging. I have a stored procedure
> that fills a temp table with 200-500 rows and then sends back 10 records at
> the time. When I go to page 2 the SP fills the temp table again and returns
> rows 10-19. The temp table is dropped after each call to the SP, so it has
> to be created and filled every time the user changes page in the datagrid.
> My question is this: Would it be more efficient to return all rows to the
> datagrid and set the visibility on each datagriditem instead? After the
> datagrid is filled up I could hide all but the 10 first datagrid items, and
> when the user changes to page 2 I could set only datagrid items 10-19
> visible etc. I have read quite a lot about custom paging, but I have never
> read anything about this approach therefore I'm interested in what you
> experts have to say. Is it a good idea?
>
>
>
> Thanks,
>
> Shawn
>
>
>

 
Reply With Quote
 
Shawn
Guest
Posts: n/a
 
      02-13-2005
Hi.
The thing is that I have to use temp tables. There is now way around it.
Don't ask why, just accept it
Anyway, specifying the number of records to be fetched in the fill method of
the dataadapter doesn't change anything. I would still have to return to
the db on each page call.

Shawn


"Kaustav" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi Shawn,
>
> creating temp tables is not an ideal solution. You would be better off

using
> derived tables as compared to temp tables. How about specifying the number

of
> records to be fetched in the Fill method of the DataAdapter when you

change
> the page of the datagrid.
>
> HTH.
>
> Kaustav Neogy.
>
> "Shawn" wrote:
>
> > Hi.
> >
> > I already have a datagrid where I'm using paging. I have a stored

procedure
> > that fills a temp table with 200-500 rows and then sends back 10 records

at
> > the time. When I go to page 2 the SP fills the temp table again and

returns
> > rows 10-19. The temp table is dropped after each call to the SP, so it

has
> > to be created and filled every time the user changes page in the

datagrid.
> > My question is this: Would it be more efficient to return all rows to

the
> > datagrid and set the visibility on each datagriditem instead? After the
> > datagrid is filled up I could hide all but the 10 first datagrid items,

and
> > when the user changes to page 2 I could set only datagrid items 10-19
> > visible etc. I have read quite a lot about custom paging, but I have

never
> > read anything about this approach therefore I'm interested in what you
> > experts have to say. Is it a good idea?
> >
> >
> >
> > Thanks,
> >
> > Shawn
> >
> >
> >



 
Reply With Quote
 
Scott Allen
Guest
Posts: n/a
 
      02-13-2005
Temp tables, derived tables - on some implementations they all boil
down to the same query plan under the covers.

--
Scott
http://www.OdeToCode.com/blogs/scott/

On Sun, 13 Feb 2005 09:17:02 -0800, "Kaustav"
<(E-Mail Removed)> wrote:

>Hi Shawn,
>
>creating temp tables is not an ideal solution. You would be better off using
>derived tables as compared to temp tables. How about specifying the number of
>records to be fetched in the Fill method of the DataAdapter when you change
>the page of the datagrid.
>
>HTH.
>
>Kaustav Neogy.
>
>"Shawn" wrote:
>
>> Hi.
>>
>> I already have a datagrid where I'm using paging. I have a stored procedure
>> that fills a temp table with 200-500 rows and then sends back 10 records at
>> the time. When I go to page 2 the SP fills the temp table again and returns
>> rows 10-19. The temp table is dropped after each call to the SP, so it has
>> to be created and filled every time the user changes page in the datagrid.
>> My question is this: Would it be more efficient to return all rows to the
>> datagrid and set the visibility on each datagriditem instead? After the
>> datagrid is filled up I could hide all but the 10 first datagrid items, and
>> when the user changes to page 2 I could set only datagrid items 10-19
>> visible etc. I have read quite a lot about custom paging, but I have never
>> read anything about this approach therefore I'm interested in what you
>> experts have to say. Is it a good idea?
>>
>>
>>
>> Thanks,
>>
>> Shawn
>>
>>
>>


 
Reply With Quote
 
Scott M.
Guest
Posts: n/a
 
      02-13-2005
I did read what you wrote. My response was basically that you have 3
choices:

1. Bring down a copy of all the data on the first page load and store it
for subsequent page loads. The pro's of this are that you don't go to the
data source on each page call. The con is that you are bringing down all
the records but only displaying some of them.

2. Use custom paging and bring down just the records you intend to show.
The upside is that you use considerably less bandwidth. The downside is
that you have to go to the datasource on each page call.

3. Hybrid of the first 2 choices...Get a copy of all the data on the fist
page load and store it. Subsequent page calls can use custom paging against
this copy of the data to get just the records you are interested in.
Advantages here are that you just make one trip to the original data store
(freeing it up to handle other application requests), you can use page
output caching to reduce server processing as well. Downside is that you
are making a copy of the data and holding it in memory somewhere.

"Shawn" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>> Why are you re-creating and re-populating the temp table on each page
>> request?

> The temp table is created by my stored procedure. When the stored
> procedure
> has finished all temp tables cerated by that SP are automatically dropped
> by
> sybase.
>
>> Why not store this data in ViewState or the Cache or some other
>> medium?

> Thats exactly what I'm considering. Return all rows from the SP (not just
> 10 and 10), fill the datagrid with all of them, but only show 10 rows at
> the
> time. That way all rows would all be stored in ViewState.
>
>> The only time you should be going back to the database is on the
>> first page load unless you want to use custom paging and you are going to
>> the db on each page call, but only bringing down 1 page worth of data.

> Didn't you read what I wrote? I am using custom paging. I am returning
> to
> the db (SP) on each page call and bringing back 1 page (10 rows) of data.
>
> Shawn
>
> "Scott M." <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> Why are you re-creating and re-populating the temp table on each page
>> request? Why not store this data in ViewState or the Cache or some other
>> medium? The only time you should be going back to the database is on the
>> first page load unless you want to use custom paging and you are going to
>> the db on each page call, but only bringing down 1 page worth of data.
>>
>>
>>
>> "Shawn" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>> > Hi.
>> >
>> > I already have a datagrid where I'm using paging. I have a stored
>> > procedure
>> > that fills a temp table with 200-500 rows and then sends back 10
>> > records
>> > at
>> > the time. When I go to page 2 the SP fills the temp table again and
>> > returns
>> > rows 10-19. The temp table is dropped after each call to the SP, so it
>> > has
>> > to be created and filled every time the user changes page in the

> datagrid.
>> > My question is this: Would it be more efficient to return all rows to

> the
>> > datagrid and set the visibility on each datagriditem instead? After
>> > the
>> > datagrid is filled up I could hide all but the 10 first datagrid items,
>> > and
>> > when the user changes to page 2 I could set only datagrid items 10-19
>> > visible etc. I have read quite a lot about custom paging, but I have
>> > never
>> > read anything about this approach therefore I'm interested in what you
>> > experts have to say. Is it a good idea?
>> >
>> >
>> >
>> > Thanks,
>> >
>> > Shawn
>> >
>> >

>>
>>

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Combining numeric mode paging and nextPreview paging in datagrid Red ASP .Net 1 03-12-2005 11:41 PM
datagrid paging - customising paging style wh1974 ASP .Net 0 01-12-2005 03:48 PM
DataSet paging vs Datareader paging =?Utf-8?B?UGF0cmljay5PLklnZQ==?= ASP .Net 1 10-08-2004 02:13 PM
Paging Dr. Who, Paging Dr. Who... Father_Sicko@TheOrphanage.com Computer Security 1 07-02-2004 08:59 PM
Custom Paging Efficiency Joseph D. DeJohn ASP .Net 1 08-06-2003 06:24 PM



Advertisments