Loading ...
Sorry, an error occurred while loading the content.

Databases - Flat File vs Relational

Expand Messages
  • Andy Schafer
    Hi, First I want to say that I am pretty new to Perl and do not know much at all about relational databases. However, I am the kind of person who likes to go
    Message 1 of 3 , Mar 30 4:18 PM
    • 0 Attachment
      Hi,

      First I want to say that I am pretty new to Perl and do not know much
      at all about relational databases. However, I am the kind of person
      who likes to go in depth with whatever I am working on. I also know
      that this debate has been covered a lot here and elsewhere and I have
      read through a lot of posts on the subject. However, I still have some
      questions.

      OK, I have a retail website that I have been running for a while. I
      have roughly 1000 different part numbers and more to come. I built a
      simple flat file database to keep track of everything and wrote a
      script that will keep quantities updated, give me editing
      capabilities, and also generate all of the html display pages for each
      category with one click of a button. All of this is pretty crudely
      written but it works well and I have been very happy with it.

      I am always thinking of new features and such and have decided to
      redesign my database to include these new ideas and more. I also have
      learned a lot more Perl since I wrote the original scripts so it will
      be a lot more efficient and organized.

      My plan is this: each file in my database will hold 1000 parts. Each
      page or group of pages will be designated for a certain category of
      parts. Finding the proper page in the database will simply involve
      taking the part# and removing the last 3 digits. This gives the page.
      I then will load the page into a hash and will access the needed
      information directly using the part number itself as the key. The
      given information will then be loaded into an array and split so that
      each piece of information (part description, quantity, price, etc) can
      be easily used.

      So, my questions are:
      1 Is there a significant increase in speed if I do this kind of thing
      in a relational database?
      2 Is there any inherent problems with this idea?
      3 Am I crazy?
      4 What are your reasons for thinking this either a good or a bad idea?

      I know what the answer to #3 is! I realize that this would probably be
      much simpler and faster if I just used a packaged script and forgot
      about writing it all myself but I just can't bring myself to give up
      the satisfaction I will feel when I successfully complete this and
      watch it work for the first time. Besides I'm sure to learn a LOT more
      by doing it myself rather than using someone else's work.

      Anyway, sorry about the lengthy post! Thanks in advance for your input.
      Andy Schafer
    • merlyn@stonehenge.com
      ... Andy First I want to say that I am pretty new to Perl and do not know much Andy at all about relational databases. However, I am the kind of person Andy
      Message 2 of 3 , Mar 30 4:37 PM
      • 0 Attachment
        >>>>> "Andy" == Andy Schafer <lostgameparts@...> writes:

        Andy> First I want to say that I am pretty new to Perl and do not know much
        Andy> at all about relational databases. However, I am the kind of person
        Andy> who likes to go in depth with whatever I am working on. I also know
        Andy> that this debate has been covered a lot here and elsewhere and I have
        Andy> read through a lot of posts on the subject. However, I still have some
        Andy> questions.

        Consider DBM::Deep which will effectively put a hash or more complex structure
        out on disk for you. Then you can use normal hash access to get what you
        want.

        --
        Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
        <merlyn@...> <URL:http://www.stonehenge.com/merlyn/>
        Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
        See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
      • jendaperl
        ... each ... have ... will ... page. ... thing ... I would expect to get one, yes. The easiest to install and powerfull enough for this is in my opinion
        Message 3 of 3 , Apr 1, 2008
        • 0 Attachment
          --- In perl-beginner@yahoogroups.com, "Andy Schafer"
          <lostgameparts@...> wrote:
          > OK, I have a retail website that I have been running for a while. I
          > have roughly 1000 different part numbers and more to come. I built a
          > simple flat file database to keep track of everything and wrote a
          > script that will keep quantities updated, give me editing
          > capabilities, and also generate all of the html display pages for
          each
          > category with one click of a button. All of this is pretty crudely
          > written but it works well and I have been very happy with it.
          >
          > I am always thinking of new features and such and have decided to
          > redesign my database to include these new ideas and more. I also
          have
          > learned a lot more Perl since I wrote the original scripts so it
          will
          > be a lot more efficient and organized.
          >
          > My plan is this: each file in my database will hold 1000 parts. Each
          > page or group of pages will be designated for a certain category of
          > parts. Finding the proper page in the database will simply involve
          > taking the part# and removing the last 3 digits. This gives the
          page.
          > I then will load the page into a hash ...
          >
          > So, my questions are:
          > 1 Is there a significant increase in speed if I do this kind of
          thing
          > in a relational database?

          I would expect to get one, yes.

          The easiest to install and powerfull enough for this is in my opinion
          SQLite. Or rather DBD::SQLite ... the database engine is included in
          the module. I do think this will not only be quicker and scale
          better, but also simplify your code.

          Jenda
        Your message has been successfully submitted and would be delivered to recipients shortly.