Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6572907
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T15:03:54+00:00 2026-05-25T15:03:54+00:00

I am working on some tables which have temporal based rows and are present

  • 0

I am working on some tables which have temporal based rows and are present in different databases. The idea is to write stored proc to get and finally process the data, which in turn would make use of many joins which will result in huge amount of data. And then I would perform some kind of aggregate logic to get the needed data.

Such a stored might need to use loops etc and would be very slow.

Could I use Views to make a table which would already be a short listed table consisting of only needed rows (obtained from joins and aggregations). I am missing some fundamentals here:
1. Do views get data at runtime only? If they do, how could I use them to increase performance.
2. Could I use indexing to increase the performance for such a view?
3. Are cursors faster than loops? I know I could use some kind of query to avoid the loops – but suppose if I have to use loop, would cursors be a better choice?

Thanks…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T15:03:55+00:00Added an answer on May 25, 2026 at 3:03 pm

    Indexed views can improve performance but read Books online on them as there are many many restriction on what kinds of views can be indexed. They can indeed help with aggregation though as long as you can meet the other conditions that an indexed view must meet.Views that call other views can degrade performance greatly, don’t use them.

    To improve performance in aggregation if you can’t use indexed views to solve your problem, one strategy is to store the aggregated values in a table that is updated through triggers anytime the underlying data changes. That way the calculation is only done once for each data change rather than repeated many times in select queries. The trigger would have to be carefully written and handle multiple record inserts/updates/deletes. If the aggregation can be slightly out of synch with real time, you can do this is in a job instead of a trigger.

    Cursors and loops are rarely needed in application code. Their real use is generally for database admin tasks. To help you understand better methods to use than looping please read this:
    http://wiki.lessthandot.com/index.php/Cursors_and_How_to_Avoid_Them

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on databases that have moving tables auto-generated by some obscure tools. By
I am working with some tables where I want the C# class to have
I have 3 tables which contain different types of data related to each other.
I have been working for some time on a library which performs numeric calculations.
Does MATLAB have any support for hash tables? Some background I am working on
I am working on a feather that export some tables(~50) to a disk file
I have been working on some legacy C++ code that uses variable length structures
I’m working on optimizing some of my queries and I have a query that
I am working on some ASP.NET web forms which involves some dynamic generation, and
I'm working on an ASP.NET MVC site which will have a database. While I'm

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.