Re: Datagrid aggregation in each cell by W
W
Wed Mar 08 16:29:23 CST 2006
The DataTable object has a good bit of power with the Compute method. It
allows for pretty powerful aggregation and it can be used to aggregate
related tables. However client side aggregation probably isn't a good idea
if you're dealing with a large amount of records. As far as timing out, so
many things can be affecting that. My first suggestion would be to look at
the query and really start to think about the table structures, indices, the
execution plan etc. Two tables joined by an intermediate third table, in
and of itself, is not somthing that should be causing huge performance
problems. Using Keys and/or indexing should be able to address a good bit of
that and there are certainly cases where doing an operation like that
without an index is so slow it's unbearable but after tuning the query,
everything works fine. However one of the biggest factors here , whether
you do it client or server side and if you go server side, how to make it
work, is the number of records involved. If may be worth creating a job
that runs those aggregates and sticks them into a table and then you just
query the table. The job can run for x minutes/hours whatever at a time when
you don't need the data (assuing there is such a time) so when you hit the
table, you're just querying 10 records or so.
If you're in the really large number realm, and you have a window that you
can use to aggregate everything, this is probably a good approach. Another
idea might be to consider using Analysis Services and building a cube. If
this data is read-only, creating a cube might be the best way to slice the
data and give you impressive performance.
Anyway, how many records are we talking about? Are there a lot of columns
in each of the two tables that are linked together by the third? Are those
fields that the joins are done on keyed or indexed? Can you post the query
that's running slow and at least a description of the parent tables' fields
that are used in the query? Thanks!
Bill
<dcmetro@gmail.com> wrote in message
news:1141850737.025496.294350@v46g2000cwv.googlegroups.com...
> Hi,
>
> I have a search page which will display the results in a datagrid. The
> grid's nature is, except the first column, every cell in every row is
> an aggregate value. The grid will always have the same number of rows
> and columns no matter what the search criteria is. It's only the values
> in the cells that change.
>
> I'm rewriting the existing application; At present they have the entire
> calculation is done in the stored procedure and the result of the
> stored procedure is simply displayed to the user. This approach
> timesout most of the time.
>
> Here's a sample datagrid I'm trying to achieve:
>
> CITY ERRORS FAILURES
> Austin 10 25
> Boston 23 2
> Chicago 13 16
> No City Mentioned 2 3
> Total 48 46
>
> Please note there may be different kind of Errors and different kind of
> Failures. We aggregate all Errors and Failures display the total errors
> and total failures respectively against each city.
>
> In the present DB model, they have a separate table for the city, a
> table for the event names -(Errors and/or Failures) and a transaction
> table that links those two tables with the station code and event code.
>
>
> My question is, how much and what can we do in the stored procedure,
> and what can we do in ADO.NET for the above case?
>
> If my question doesn't make sense, please let me know I'll try to
> rephrase it.
>
> Thank you.
>