#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2012
    Posts
    2
    Rep Power
    0

    Creating a table based on query, and having it auto refresh


    I have a query that takes forever to load, and I'm looking for away to speed it up.

    Is it possible to create a local "table" using the query and having it auto update on daily or hourly basis so that all I need to do is select* from the local table?

    I would appreciate any help...
  2. #2
  3. SQL Consultant
    Devshed Supreme Being (6500+ posts)

    Join Date
    Feb 2003
    Location
    Toronto Canada
    Posts
    27,179
    Rep Power
    4279
    the answer is no

    what you were thinking of with the idea of "select star" is a view

    however, a view is only as efficient as its underlying query

    you need to address your query's inefficiency

    there is no way to "automatically" save the results of a query -- you would ahve to do that explicitly with an SQL statement that you execute
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2012
    Posts
    2
    Rep Power
    0
    Originally Posted by r937
    the answer is no

    what you were thinking of with the idea of "select star" is a view

    however, a view is only as efficient as its underlying query

    you need to address your query's inefficiency

    there is no way to "automatically" save the results of a query -- you would ahve to do that explicitly with an SQL statement that you execute
    I was thinking when people speak of stored procedure, this is exactly what it does.
    The query has so many joined table that it takes >20 minutes to run, would be much easire to store the result to a table and having it refresh on daily basis.
    I'm just surprised that there is no such feature built into sql

IMN logo majestic logo threadwatch logo seochat tools logo