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. Read Only Database

Read Only Database

Scheduled Pinned Locked Moved Database
announcementdatabaseperformancequestion
10 Posts 4 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.
  • B Offline
    B Offline
    Bastien Vandamme
    wrote on last edited by
    #1

    For one of my project I need to create a read only database. I'm authorized to create INSERT and SELECT queries but not UPDATE or DELETE. To do that I suppose I need to add a DATE_STAMP column on each table and adapt all the SELECT to filter only the latest version of my record. Is this realizable in term of performance, size of data, queries? Do you have suggestions, documentations, links about the subject. Thank you,

    Kornfeld Eliyahu PeterK J M 3 Replies Last reply
    0
    • B Bastien Vandamme

      For one of my project I need to create a read only database. I'm authorized to create INSERT and SELECT queries but not UPDATE or DELETE. To do that I suppose I need to add a DATE_STAMP column on each table and adapt all the SELECT to filter only the latest version of my record. Is this realizable in term of performance, size of data, queries? Do you have suggestions, documentations, links about the subject. Thank you,

      Kornfeld Eliyahu PeterK Offline
      Kornfeld Eliyahu PeterK Offline
      Kornfeld Eliyahu Peter
      wrote on last edited by
      #2

      Of course you do not talk about 'read only' database as SQL means it - 'read only' is a state of the database when no-one can do any write functions, including insert. What you are talking about is that your inserts are fixed and final, can't be removed or updated... for that you have to learn about GRANT[^]/DENY[^]/REVOKE[^] of SQL permissions... For instance, this will prevent from user MyUser to run UPDATE and DELETE queries on table MyTable...

      DENY UPDATE, DELETE ON MyTable TO MyUser

      I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)

      "It never ceases to amaze me that a spacecraft launched in 1977 can be fixed remotely from Earth." ― Brian Cox

      1 Reply Last reply
      0
      • B Bastien Vandamme

        For one of my project I need to create a read only database. I'm authorized to create INSERT and SELECT queries but not UPDATE or DELETE. To do that I suppose I need to add a DATE_STAMP column on each table and adapt all the SELECT to filter only the latest version of my record. Is this realizable in term of performance, size of data, queries? Do you have suggestions, documentations, links about the subject. Thank you,

        J Offline
        J Offline
        Jorgen Andersson
        wrote on last edited by
        #3

        B413 wrote:

        Is this realizable in term of performance, size of data, queries

        With proper indexing and eventually partitioning it won't be a problem. Harddisk space is cheap nowadays.

        Wrong is evil and must be defeated. - Jeff Ello[^]

        1 Reply Last reply
        0
        • B Bastien Vandamme

          For one of my project I need to create a read only database. I'm authorized to create INSERT and SELECT queries but not UPDATE or DELETE. To do that I suppose I need to add a DATE_STAMP column on each table and adapt all the SELECT to filter only the latest version of my record. Is this realizable in term of performance, size of data, queries? Do you have suggestions, documentations, links about the subject. Thank you,

          M Offline
          M Offline
          Mycroft Holmes
          wrote on last edited by
          #4

          I would call this auditing, unless I have the requirement completely wrong, where you need to track changes but retain only the current information in the table. This is one of the few valid uses for triggers spit. Use a trigger to fire on inset/update/delete, on insert and delete grab the ID, you don't need each field value here, on update grab the before and after values, the ID on the user and shove them into an audit table. If you are doing bulk inserts (etl data in) then turn off the triggers before processing.

          Never underestimate the power of human stupidity RAH

          J B 2 Replies Last reply
          0
          • M Mycroft Holmes

            I would call this auditing, unless I have the requirement completely wrong, where you need to track changes but retain only the current information in the table. This is one of the few valid uses for triggers spit. Use a trigger to fire on inset/update/delete, on insert and delete grab the ID, you don't need each field value here, on update grab the before and after values, the ID on the user and shove them into an audit table. If you are doing bulk inserts (etl data in) then turn off the triggers before processing.

            Never underestimate the power of human stupidity RAH

            J Offline
            J Offline
            Jorgen Andersson
            wrote on last edited by
            #5

            I think hell just froze over. Did you just recommend the use of a trigger? (spit)

            Wrong is evil and must be defeated. - Jeff Ello[^]

            M 1 Reply Last reply
            0
            • M Mycroft Holmes

              I would call this auditing, unless I have the requirement completely wrong, where you need to track changes but retain only the current information in the table. This is one of the few valid uses for triggers spit. Use a trigger to fire on inset/update/delete, on insert and delete grab the ID, you don't need each field value here, on update grab the before and after values, the ID on the user and shove them into an audit table. If you are doing bulk inserts (etl data in) then turn off the triggers before processing.

              Never underestimate the power of human stupidity RAH

              B Offline
              B Offline
              Bastien Vandamme
              wrote on last edited by
              #6

              What you suggest is one of my possibilities but I would like to investigate on the possibility only to allow INSERT and SELECT. I my case I need to prove that NOBODY can never hack the system and modify a tracking data. A trigger can be deactivated. I would like to GRANT only INSERT and SELECT to all users. I saw system build for FDA rules where developers or DBA can still have all the power on production database and I saw them removing audit data on production. Wrong and testing data in this case but where is the limit between this and falsification.

              M 1 Reply Last reply
              0
              • J Jorgen Andersson

                I think hell just froze over. Did you just recommend the use of a trigger? (spit)

                Wrong is evil and must be defeated. - Jeff Ello[^]

                M Offline
                M Offline
                Mycroft Holmes
                wrote on last edited by
                #7

                Jörgen Andersson wrote:

                Did you just recommend the use of a trigger

                Yeah I feel dirty, had to do it again in the c# forum for the same reason ugh. It must be the change in local, I'm on holidays in Cairns, it must be affecting my vitriol levels.

                Never underestimate the power of human stupidity RAH

                J 1 Reply Last reply
                0
                • B Bastien Vandamme

                  What you suggest is one of my possibilities but I would like to investigate on the possibility only to allow INSERT and SELECT. I my case I need to prove that NOBODY can never hack the system and modify a tracking data. A trigger can be deactivated. I would like to GRANT only INSERT and SELECT to all users. I saw system build for FDA rules where developers or DBA can still have all the power on production database and I saw them removing audit data on production. Wrong and testing data in this case but where is the limit between this and falsification.

                  M Offline
                  M Offline
                  Mycroft Holmes
                  wrote on last edited by
                  #8

                  Ok so this has nothing to do with read only, it is about locking down your database with enough security to pacify your clients paranoia. Good luck, delving into the high levels of database security is not a trivial excercise. Personally I would try and get hold of a DBA/expert in the area if your client can justify the expense.

                  Never underestimate the power of human stupidity RAH

                  B 1 Reply Last reply
                  0
                  • M Mycroft Holmes

                    Jörgen Andersson wrote:

                    Did you just recommend the use of a trigger

                    Yeah I feel dirty, had to do it again in the c# forum for the same reason ugh. It must be the change in local, I'm on holidays in Cairns, it must be affecting my vitriol levels.

                    Never underestimate the power of human stupidity RAH

                    J Offline
                    J Offline
                    Jorgen Andersson
                    wrote on last edited by
                    #9

                    If it's of any consolation, I'm totally agreeing with you not just in general on this subject but also about this exception.

                    Wrong is evil and must be defeated. - Jeff Ello[^]

                    1 Reply Last reply
                    0
                    • M Mycroft Holmes

                      Ok so this has nothing to do with read only, it is about locking down your database with enough security to pacify your clients paranoia. Good luck, delving into the high levels of database security is not a trivial excercise. Personally I would try and get hold of a DBA/expert in the area if your client can justify the expense.

                      Never underestimate the power of human stupidity RAH

                      B Offline
                      B Offline
                      Bastien Vandamme
                      wrote on last edited by
                      #10

                      It's not about paranoia... unit testing, business and database testing has been for client paranoia and audit validation. In my case it's about respecting law and users protection.

                      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