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. General Programming
  3. C#
  4. XML or database...?

XML or database...?

Scheduled Pinned Locked Moved C#
questiondatabasexml
11 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.
  • P Pankaj Joshi

    I'm having 500 hard coded records in a database. Now I thinking about to make a XML for that..So Which one is faster...? A XML file or a database table ..? If a XML is faster then what is the best way to retrieve the data from it...? A dataset or make a XML parser for that...? :^)

    Regards Pankaj Joshi If you want to shape your dreams into reality, please wake-up...

    S Offline
    S Offline
    StianSandberg
    wrote on last edited by
    #2

    If you store all your data in one single xml-file you will have to query wich data to show by using xpath (I guess you wont show all data at once). Another way is to create some xsl-files. But use a database if you can. It's much easier to work with data stored in a database and I think it's faster too. If this data is static and performance is a big issue you should consider generating static html-files (if it's a webapplication)

    --------------- www.serverside.no

    B 1 Reply Last reply
    0
    • P Pankaj Joshi

      I'm having 500 hard coded records in a database. Now I thinking about to make a XML for that..So Which one is faster...? A XML file or a database table ..? If a XML is faster then what is the best way to retrieve the data from it...? A dataset or make a XML parser for that...? :^)

      Regards Pankaj Joshi If you want to shape your dreams into reality, please wake-up...

      D Offline
      D Offline
      darkelv
      wrote on last edited by
      #3

      Database, ie SQL CE. Faster or not depends on how you use it. Do you load the XML into memory once and use the data from memory? or do you have to query the XML every time? If you load them into memory, you will be hogging a lot of memory. You won't know if you wake up one day, the requirement has been changed to 6000 records, must be able to add or delete, and changes needs to be deployed to 500 users.

      C 1 Reply Last reply
      0
      • S StianSandberg

        If you store all your data in one single xml-file you will have to query wich data to show by using xpath (I guess you wont show all data at once). Another way is to create some xsl-files. But use a database if you can. It's much easier to work with data stored in a database and I think it's faster too. If this data is static and performance is a big issue you should consider generating static html-files (if it's a webapplication)

        --------------- www.serverside.no

        B Offline
        B Offline
        blackjack2150
        wrote on last edited by
        #4

        Serverside wrote:

        If you store all your data in one single xml-file you will have to query wich data to show by using xpath...

        Not really. If you use the class XmlDataDocument, you can manipulate XML data through a relational Dataset, so in a similar manner to that used in regular databases. If there are only 500 records I would recommend either using XmlDataDocument or using an Access database file. The need for a database server like SQL Server or MySql is not justified in such a scenario.

        C 1 Reply Last reply
        0
        • D darkelv

          Database, ie SQL CE. Faster or not depends on how you use it. Do you load the XML into memory once and use the data from memory? or do you have to query the XML every time? If you load them into memory, you will be hogging a lot of memory. You won't know if you wake up one day, the requirement has been changed to 6000 records, must be able to add or delete, and changes needs to be deployed to 500 users.

          C Offline
          C Offline
          Colin Angus Mackay
          wrote on last edited by
          #5

          darkelv wrote:

          If you load them into memory, you will be hogging a lot of memory.

          How do you know? He hasn't said what the 500 records are! It might be 500 IDs with a string value consisting of a few words (lets say 20 chars average). That is 24 bytes (or 44 for Unicode). So that is a whopping 22K. Wow! That's a real memory hungry application.

          darkelv wrote:

          You won't know if you wake up one day, the requirement has been changed to 6000 records, must be able to add or delete, and changes needs to be deployed to 500 users.

          Where did he say he had 500 users? And why couldn't the XML file be located in a central location on a network? You are making a lot of assumptions that were not in the original query. If you are going to do that then you should say that these are your assumptions and therefore they may possibly not apply to the situation.


          Upcoming FREE developer events: * Developer Day Scotland My website | blog

          D 1 Reply Last reply
          0
          • B blackjack2150

            Serverside wrote:

            If you store all your data in one single xml-file you will have to query wich data to show by using xpath...

            Not really. If you use the class XmlDataDocument, you can manipulate XML data through a relational Dataset, so in a similar manner to that used in regular databases. If there are only 500 records I would recommend either using XmlDataDocument or using an Access database file. The need for a database server like SQL Server or MySql is not justified in such a scenario.

            C Offline
            C Offline
            Colin Angus Mackay
            wrote on last edited by
            #6

            blackjack2150 wrote:

            If there are only 500 records I would recommend either using XmlDataDocument or using an Access database file. The need for a database server like SQL Server or MySql is not justified in such a scenario.

            What if SQL Server is being used for other data in the application? In that case it becomes a valid candidate. Adding Access to the mix in that scenario would be a very poor idea.


            Upcoming FREE developer events: * Developer Day Scotland My website | blog

            1 Reply Last reply
            0
            • P Pankaj Joshi

              I'm having 500 hard coded records in a database. Now I thinking about to make a XML for that..So Which one is faster...? A XML file or a database table ..? If a XML is faster then what is the best way to retrieve the data from it...? A dataset or make a XML parser for that...? :^)

              Regards Pankaj Joshi If you want to shape your dreams into reality, please wake-up...

              C Offline
              C Offline
              Colin Angus Mackay
              wrote on last edited by
              #7

              Pankaj - Joshi wrote:

              I'm having 500 hard coded records in a database. Now I thinking about to make a XML for that..So Which one is faster...? A XML file or a database table ..?

              It depends on what you are using these records for. How do you intend to query them? What do they contain?

              Pankaj - Joshi wrote:

              If a XML is faster then what is the best way to retrieve the data from it...?

              For example, if the data is a simple key/value lookup then loading it into a Hashtable may be the best thing to do. However, it really depends on what this data is.


              Upcoming FREE developer events: * Developer Day Scotland My website | blog

              A 1 Reply Last reply
              0
              • C Colin Angus Mackay

                Pankaj - Joshi wrote:

                I'm having 500 hard coded records in a database. Now I thinking about to make a XML for that..So Which one is faster...? A XML file or a database table ..?

                It depends on what you are using these records for. How do you intend to query them? What do they contain?

                Pankaj - Joshi wrote:

                If a XML is faster then what is the best way to retrieve the data from it...?

                For example, if the data is a simple key/value lookup then loading it into a Hashtable may be the best thing to do. However, it really depends on what this data is.


                Upcoming FREE developer events: * Developer Day Scotland My website | blog

                A Offline
                A Offline
                anandakumarm
                wrote on last edited by
                #8

                XML is very faster than Database :)

                Like a good handsome...thanking You

                C 1 Reply Last reply
                0
                • A anandakumarm

                  XML is very faster than Database :)

                  Like a good handsome...thanking You

                  C Offline
                  C Offline
                  Colin Angus Mackay
                  wrote on last edited by
                  #9

                  anandakumarm wrote:

                  XML is very faster than Database

                  That is a very wide sweeping statement that is incorrect in most scenarios.


                  Upcoming FREE developer events: * Developer Day Scotland My website | blog

                  1 Reply Last reply
                  0
                  • C Colin Angus Mackay

                    darkelv wrote:

                    If you load them into memory, you will be hogging a lot of memory.

                    How do you know? He hasn't said what the 500 records are! It might be 500 IDs with a string value consisting of a few words (lets say 20 chars average). That is 24 bytes (or 44 for Unicode). So that is a whopping 22K. Wow! That's a real memory hungry application.

                    darkelv wrote:

                    You won't know if you wake up one day, the requirement has been changed to 6000 records, must be able to add or delete, and changes needs to be deployed to 500 users.

                    Where did he say he had 500 users? And why couldn't the XML file be located in a central location on a network? You are making a lot of assumptions that were not in the original query. If you are going to do that then you should say that these are your assumptions and therefore they may possibly not apply to the situation.


                    Upcoming FREE developer events: * Developer Day Scotland My website | blog

                    D Offline
                    D Offline
                    darkelv
                    wrote on last edited by
                    #10

                    Feeling cranky, eh. That's what the "if" for. Since he didn't supply more information, I am giving him something to ponder before he decide what he want to do.

                    C 1 Reply Last reply
                    0
                    • D darkelv

                      Feeling cranky, eh. That's what the "if" for. Since he didn't supply more information, I am giving him something to ponder before he decide what he want to do.

                      C Offline
                      C Offline
                      Colin Angus Mackay
                      wrote on last edited by
                      #11

                      darkelv wrote:

                      That's what the "if" for.

                      No, it wasn't. You said: "If you load them into memory, you will be hogging a lot of memory." That indicates that you have already made the assumption that the data set is large, not IF the data set is large. I pointed out a fairly reasonable scenario where the data set wouldn't really take that much memory.


                      Upcoming FREE developer events: * Developer Day Scotland My website | blog

                      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