Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. stored procedure or views?

stored procedure or views?

Scheduled Pinned Locked Moved Database
databasecomperformancequestionannouncement
6 Posts 6 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Jassim Rahma
    wrote on last edited by
    #1

    Hi, I would like to ask if I have a query like this:

    SELECT * FROM member

    which one is better to use specially performance wise, stored procedure or views?

    Technology News @ www.JassimRahma.com

    P Richard DeemingR A A 4 Replies Last reply
    0
    • J Jassim Rahma

      Hi, I would like to ask if I have a query like this:

      SELECT * FROM member

      which one is better to use specially performance wise, stored procedure or views?

      Technology News @ www.JassimRahma.com

      P Online
      P Online
      PIEBALDconsult
      wrote on last edited by
      #2

      Neither; it's fine the way it is. There may be other reasons to choose to write a view or a procedure, but performance generally isn't one of them.

      1 Reply Last reply
      0
      • J Jassim Rahma

        Hi, I would like to ask if I have a query like this:

        SELECT * FROM member

        which one is better to use specially performance wise, stored procedure or views?

        Technology News @ www.JassimRahma.com

        Richard DeemingR Offline
        Richard DeemingR Offline
        Richard Deeming
        wrote on last edited by
        #3

        If you're going to use SELECT * FROM ... rather than an explicit list of columns, you should be aware of this potential problem with views[^]: any changes to the underlying table will not be reflected in the view unless you explicitly refresh it. Since your application is likely to expect a specific list of columns, it's always better to selected them explicitly. The SELECT * FROM ... syntax should only be used for temporary ad-hoc queries when you're exploring the data.


        "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

        "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

        J 1 Reply Last reply
        0
        • Richard DeemingR Richard Deeming

          If you're going to use SELECT * FROM ... rather than an explicit list of columns, you should be aware of this potential problem with views[^]: any changes to the underlying table will not be reflected in the view unless you explicitly refresh it. Since your application is likely to expect a specific list of columns, it's always better to selected them explicitly. The SELECT * FROM ... syntax should only be used for temporary ad-hoc queries when you're exploring the data.


          "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

          J Offline
          J Offline
          jschell
          wrote on last edited by
          #4

          Richard Deeming wrote:

          ...will not be reflected in the view unless you explicitly refresh it.

          Select * is a problem regardless of how it originates.

          1 Reply Last reply
          0
          • J Jassim Rahma

            Hi, I would like to ask if I have a query like this:

            SELECT * FROM member

            which one is better to use specially performance wise, stored procedure or views?

            Technology News @ www.JassimRahma.com

            A Offline
            A Offline
            Arun Vasu
            wrote on last edited by
            #5

            my suggestion is stored procedure. its create execution plan while create the procedure.

            1 Reply Last reply
            0
            • J Jassim Rahma

              Hi, I would like to ask if I have a query like this:

              SELECT * FROM member

              which one is better to use specially performance wise, stored procedure or views?

              Technology News @ www.JassimRahma.com

              A Offline
              A Offline
              Aatif Ali from Bangalore
              wrote on last edited by
              #6

              Based on the performance considerations, the SPs are more versatile and allow a broader range of inquiries and actions than the views.

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups