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. The Lounge
  3. How NOT to optimize a database!

How NOT to optimize a database!

Scheduled Pinned Locked Moved The Lounge
c++performancephpdatabasecom
57 Posts 26 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.
  • N Offline
    N Offline
    Nish Nishant
    wrote on last edited by
    #1

    http://articles.economictimes.indiatimes.com/2011-10-23/news/30313183_1_diwali-rush-western-railway-berths[^] TLDR : The IT company that designed the online reservation system for India's western railways used a 3-character field storing numbers to hold the reservation token (001 to 999) on a per-train basis. This limit was never ever hit until last week when (due to Diwali, an Indian festival) enough people made online bookings that the database crashed and with it the reservation system. Funny side-bit : 3 characters (even non-Unicode) is still larger than a short int (memory wise). So whoever did this pseudo-optimization was terribly ignorant.

    Regards, Nish


    My technology blog: voidnish.wordpress.com Part 2 in my WinRT/C++ series : Visual C++ and WinRT/Metro - Databinding Basics

    C B C P A 9 Replies Last reply
    0
    • N Nish Nishant

      http://articles.economictimes.indiatimes.com/2011-10-23/news/30313183_1_diwali-rush-western-railway-berths[^] TLDR : The IT company that designed the online reservation system for India's western railways used a 3-character field storing numbers to hold the reservation token (001 to 999) on a per-train basis. This limit was never ever hit until last week when (due to Diwali, an Indian festival) enough people made online bookings that the database crashed and with it the reservation system. Funny side-bit : 3 characters (even non-Unicode) is still larger than a short int (memory wise). So whoever did this pseudo-optimization was terribly ignorant.

      Regards, Nish


      My technology blog: voidnish.wordpress.com Part 2 in my WinRT/C++ series : Visual C++ and WinRT/Metro - Databinding Basics

      C Offline
      C Offline
      Chris Meech
      wrote on last edited by
      #2

      From the article, "We could not foresee that e-tickets would ever reach 1,000. This number was beyond all our estimates when the software was created. Today, the moment 999 was breached, the program developed a bug and starting behaving abnormally. ....." :doh: :doh: :doh: When was the software created? In 666. :)

      Chris Meech I am Canadian. [heard in a local bar] In theory there is no difference between theory and practice. In practice there is. [Yogi Berra] posting about Crystal Reports here is like discussing gay marriage on a catholic church’s website.[Nishant Sivakumar]

      N C Sander RosselS V 4 Replies Last reply
      0
      • C Chris Meech

        From the article, "We could not foresee that e-tickets would ever reach 1,000. This number was beyond all our estimates when the software was created. Today, the moment 999 was breached, the program developed a bug and starting behaving abnormally. ....." :doh: :doh: :doh: When was the software created? In 666. :)

        Chris Meech I am Canadian. [heard in a local bar] In theory there is no difference between theory and practice. In practice there is. [Yogi Berra] posting about Crystal Reports here is like discussing gay marriage on a catholic church’s website.[Nishant Sivakumar]

        N Offline
        N Offline
        Nish Nishant
        wrote on last edited by
        #3

        In India, online shopping is still limited to a minority of upper-middle and upper-class folks. Recently though the masses have started using credit cards online, so that is a factor although the whole thing is still rather stupid.

        Regards, Nish


        My technology blog: voidnish.wordpress.com Part 2 in my WinRT/C++ series : Visual C++ and WinRT/Metro - Databinding Basics

        B 1 Reply Last reply
        0
        • N Nish Nishant

          http://articles.economictimes.indiatimes.com/2011-10-23/news/30313183_1_diwali-rush-western-railway-berths[^] TLDR : The IT company that designed the online reservation system for India's western railways used a 3-character field storing numbers to hold the reservation token (001 to 999) on a per-train basis. This limit was never ever hit until last week when (due to Diwali, an Indian festival) enough people made online bookings that the database crashed and with it the reservation system. Funny side-bit : 3 characters (even non-Unicode) is still larger than a short int (memory wise). So whoever did this pseudo-optimization was terribly ignorant.

          Regards, Nish


          My technology blog: voidnish.wordpress.com Part 2 in my WinRT/C++ series : Visual C++ and WinRT/Metro - Databinding Basics

          B Offline
          B Offline
          Bassam Abdul Baki
          wrote on last edited by
          #4

          I could never understand why people only allow for 50% or 100% expansion. Always allow for 10 times even though you may never reach it. Yes, I know every bit counts, but better to lose a few bits than gain a bitch.

          Web - BM - RSS - Math - LinkedIn

          N V K 3 Replies Last reply
          0
          • B Bassam Abdul Baki

            I could never understand why people only allow for 50% or 100% expansion. Always allow for 10 times even though you may never reach it. Yes, I know every bit counts, but better to lose a few bits than gain a bitch.

            Web - BM - RSS - Math - LinkedIn

            N Offline
            N Offline
            Nish Nishant
            wrote on last edited by
            #5

            This was probably some "smart" kid fresh with his 31337 coding skills who wanted to do some fancy "optimizations".

            Regards, Nish


            My technology blog: voidnish.wordpress.com Part 2 in my WinRT/C++ series : Visual C++ and WinRT/Metro - Databinding Basics

            B 1 Reply Last reply
            0
            • N Nish Nishant

              This was probably some "smart" kid fresh with his 31337 coding skills who wanted to do some fancy "optimizations".

              Regards, Nish


              My technology blog: voidnish.wordpress.com Part 2 in my WinRT/C++ series : Visual C++ and WinRT/Metro - Databinding Basics

              B Offline
              B Offline
              Bassam Abdul Baki
              wrote on last edited by
              #6

              Probably. Hopefully, lesson learned and QA earned.

              Web - BM - RSS - Math - LinkedIn

              1 Reply Last reply
              0
              • C Chris Meech

                From the article, "We could not foresee that e-tickets would ever reach 1,000. This number was beyond all our estimates when the software was created. Today, the moment 999 was breached, the program developed a bug and starting behaving abnormally. ....." :doh: :doh: :doh: When was the software created? In 666. :)

                Chris Meech I am Canadian. [heard in a local bar] In theory there is no difference between theory and practice. In practice there is. [Yogi Berra] posting about Crystal Reports here is like discussing gay marriage on a catholic church’s website.[Nishant Sivakumar]

                C Offline
                C Offline
                Chris Maunder
                wrote on last edited by
                #7

                Chris Meech wrote:

                Today, the moment 999 was breached, the program developed a bug

                No, the bug was already there, guys.

                cheers, Chris Maunder The Code Project | Co-founder Microsoft C++ MVP

                Sander RosselS J Y 3 Replies Last reply
                0
                • N Nish Nishant

                  http://articles.economictimes.indiatimes.com/2011-10-23/news/30313183_1_diwali-rush-western-railway-berths[^] TLDR : The IT company that designed the online reservation system for India's western railways used a 3-character field storing numbers to hold the reservation token (001 to 999) on a per-train basis. This limit was never ever hit until last week when (due to Diwali, an Indian festival) enough people made online bookings that the database crashed and with it the reservation system. Funny side-bit : 3 characters (even non-Unicode) is still larger than a short int (memory wise). So whoever did this pseudo-optimization was terribly ignorant.

                  Regards, Nish


                  My technology blog: voidnish.wordpress.com Part 2 in my WinRT/C++ series : Visual C++ and WinRT/Metro - Databinding Basics

                  C Offline
                  C Offline
                  Chris Maunder
                  wrote on last edited by
                  #8

                  I'm sure lots of members are biting their tongues on this one.

                  cheers, Chris Maunder The Code Project | Co-founder Microsoft C++ MVP

                  N D H 3 Replies Last reply
                  0
                  • C Chris Maunder

                    I'm sure lots of members are biting their tongues on this one.

                    cheers, Chris Maunder The Code Project | Co-founder Microsoft C++ MVP

                    N Offline
                    N Offline
                    Nish Nishant
                    wrote on last edited by
                    #9

                    Chris Maunder wrote:

                    I'm sure lots of members are biting their tongues on this one.

                    Well it was not by accident that I posted it here and not the GIT. ;)

                    Regards, Nish


                    My technology blog: voidnish.wordpress.com Part 2 in my WinRT/C++ series : Visual C++ and WinRT/Metro - Databinding Basics

                    C 1 Reply Last reply
                    0
                    • N Nish Nishant

                      Chris Maunder wrote:

                      I'm sure lots of members are biting their tongues on this one.

                      Well it was not by accident that I posted it here and not the GIT. ;)

                      Regards, Nish


                      My technology blog: voidnish.wordpress.com Part 2 in my WinRT/C++ series : Visual C++ and WinRT/Metro - Databinding Basics

                      C Offline
                      C Offline
                      Chris Maunder
                      wrote on last edited by
                      #10

                      :-D

                      cheers, Chris Maunder The Code Project | Co-founder Microsoft C++ MVP

                      1 Reply Last reply
                      0
                      • N Nish Nishant

                        http://articles.economictimes.indiatimes.com/2011-10-23/news/30313183_1_diwali-rush-western-railway-berths[^] TLDR : The IT company that designed the online reservation system for India's western railways used a 3-character field storing numbers to hold the reservation token (001 to 999) on a per-train basis. This limit was never ever hit until last week when (due to Diwali, an Indian festival) enough people made online bookings that the database crashed and with it the reservation system. Funny side-bit : 3 characters (even non-Unicode) is still larger than a short int (memory wise). So whoever did this pseudo-optimization was terribly ignorant.

                        Regards, Nish


                        My technology blog: voidnish.wordpress.com Part 2 in my WinRT/C++ series : Visual C++ and WinRT/Metro - Databinding Basics

                        P Offline
                        P Offline
                        Pascal Ganaye
                        wrote on last edited by
                        #11

                        The sad thing is that it is one column in a 300 pages specification. The guy who do the specifications often do not have the technical expertise to know that a 16 bit integer can store 32000 values in 2 bytes. The programmer usually does, but the programmer is part of the chain. Every programmer is confronted to this problem at times. Do I raise the issue? If you raise the issue it will waste a few hours and you might end up finishing your development late. Also If you raise issues a bit too often you're quickly categorized as annoying git who can't follow orders. This is not the best way to progress in a company. I am not sure if this is true in India but this is true in the countries I worked in. If you shut up and follow orders, you won't get blamed and if you're on time you'll perhaps be promoted. The blame goes on the guy who did the specs despite the fact that the programmer is the best person to notice and fix the issue. To me this is the waterfall drama.

                        A N Sander RosselS A 4 Replies Last reply
                        0
                        • P Pascal Ganaye

                          The sad thing is that it is one column in a 300 pages specification. The guy who do the specifications often do not have the technical expertise to know that a 16 bit integer can store 32000 values in 2 bytes. The programmer usually does, but the programmer is part of the chain. Every programmer is confronted to this problem at times. Do I raise the issue? If you raise the issue it will waste a few hours and you might end up finishing your development late. Also If you raise issues a bit too often you're quickly categorized as annoying git who can't follow orders. This is not the best way to progress in a company. I am not sure if this is true in India but this is true in the countries I worked in. If you shut up and follow orders, you won't get blamed and if you're on time you'll perhaps be promoted. The blame goes on the guy who did the specs despite the fact that the programmer is the best person to notice and fix the issue. To me this is the waterfall drama.

                          A Offline
                          A Offline
                          AspDotNetDev
                          wrote on last edited by
                          #12

                          Pascal Ganaye wrote:

                          The guy who do the specifications often do not have the technical expertise to know that a 16 bit integer can store 32000 values in 2 bytes

                          Ahem. 65,536 values.

                          Somebody in an online forum wrote:

                          INTJs never really joke. They make a point. The joke is just a gift wrapper.

                          N P N 3 Replies Last reply
                          0
                          • P Pascal Ganaye

                            The sad thing is that it is one column in a 300 pages specification. The guy who do the specifications often do not have the technical expertise to know that a 16 bit integer can store 32000 values in 2 bytes. The programmer usually does, but the programmer is part of the chain. Every programmer is confronted to this problem at times. Do I raise the issue? If you raise the issue it will waste a few hours and you might end up finishing your development late. Also If you raise issues a bit too often you're quickly categorized as annoying git who can't follow orders. This is not the best way to progress in a company. I am not sure if this is true in India but this is true in the countries I worked in. If you shut up and follow orders, you won't get blamed and if you're on time you'll perhaps be promoted. The blame goes on the guy who did the specs despite the fact that the programmer is the best person to notice and fix the issue. To me this is the waterfall drama.

                            N Offline
                            N Offline
                            Nish Nishant
                            wrote on last edited by
                            #13

                            Interesting points!

                            Regards, Nish


                            My technology blog: voidnish.wordpress.com Part 2 in my WinRT/C++ series : Visual C++ and WinRT/Metro - Databinding Basics

                            1 Reply Last reply
                            0
                            • A AspDotNetDev

                              Pascal Ganaye wrote:

                              The guy who do the specifications often do not have the technical expertise to know that a 16 bit integer can store 32000 values in 2 bytes

                              Ahem. 65,536 values.

                              Somebody in an online forum wrote:

                              INTJs never really joke. They make a point. The joke is just a gift wrapper.

                              N Offline
                              N Offline
                              Nish Nishant
                              wrote on last edited by
                              #14

                              He probably kept aside the sign bit to specify gender. :-D

                              Regards, Nish


                              My technology blog: voidnish.wordpress.com Part 2 in my WinRT/C++ series : Visual C++ and WinRT/Metro - Databinding Basics

                              1 Reply Last reply
                              0
                              • N Nish Nishant

                                http://articles.economictimes.indiatimes.com/2011-10-23/news/30313183_1_diwali-rush-western-railway-berths[^] TLDR : The IT company that designed the online reservation system for India's western railways used a 3-character field storing numbers to hold the reservation token (001 to 999) on a per-train basis. This limit was never ever hit until last week when (due to Diwali, an Indian festival) enough people made online bookings that the database crashed and with it the reservation system. Funny side-bit : 3 characters (even non-Unicode) is still larger than a short int (memory wise). So whoever did this pseudo-optimization was terribly ignorant.

                                Regards, Nish


                                My technology blog: voidnish.wordpress.com Part 2 in my WinRT/C++ series : Visual C++ and WinRT/Metro - Databinding Basics

                                A Offline
                                A Offline
                                Andy Brummer
                                wrote on last edited by
                                #15

                                From the US, I think the response would be they can fit 999 people on a train? :-D On the other side of the situation. The guy in charge of the India unique ID project gave a talk at the foundation where I work. That is a mind boggling huge project, and seem to be doing good planning to prevent these kinds of issues.

                                Curvature of the Mind now with 3D

                                N 1 Reply Last reply
                                0
                                • C Chris Maunder

                                  I'm sure lots of members are biting their tongues on this one.

                                  cheers, Chris Maunder The Code Project | Co-founder Microsoft C++ MVP

                                  D Offline
                                  D Offline
                                  Dave Kreskowiak
                                  wrote on last edited by
                                  #16

                                  Oh, you have no idea. I dare not post a single story about the outside "help" we have right now.

                                  A guide to posting questions on CodeProject[^]
                                  Dave Kreskowiak

                                  1 Reply Last reply
                                  0
                                  • C Chris Maunder

                                    I'm sure lots of members are biting their tongues on this one.

                                    cheers, Chris Maunder The Code Project | Co-founder Microsoft C++ MVP

                                    H Offline
                                    H Offline
                                    Henry Minute
                                    wrote on last edited by
                                    #17

                                    Whistles tunelessly and saunters slowly away.................

                                    Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.” I wouldn't let CG touch my Abacus! When you're wrestling a gorilla, you don't stop when you're tired, you stop when the gorilla is.

                                    1 Reply Last reply
                                    0
                                    • C Chris Maunder

                                      Chris Meech wrote:

                                      Today, the moment 999 was breached, the program developed a bug

                                      No, the bug was already there, guys.

                                      cheers, Chris Maunder The Code Project | Co-founder Microsoft C++ MVP

                                      Sander RosselS Offline
                                      Sander RosselS Offline
                                      Sander Rossel
                                      wrote on last edited by
                                      #18

                                      Unless they created true Artificial Intelligence... Or is that called Virtual Intelligence? :D

                                      It's an OO world.

                                      public class Naerling : Lazy<Person>{}

                                      1 Reply Last reply
                                      0
                                      • C Chris Meech

                                        From the article, "We could not foresee that e-tickets would ever reach 1,000. This number was beyond all our estimates when the software was created. Today, the moment 999 was breached, the program developed a bug and starting behaving abnormally. ....." :doh: :doh: :doh: When was the software created? In 666. :)

                                        Chris Meech I am Canadian. [heard in a local bar] In theory there is no difference between theory and practice. In practice there is. [Yogi Berra] posting about Crystal Reports here is like discussing gay marriage on a catholic church’s website.[Nishant Sivakumar]

                                        Sander RosselS Offline
                                        Sander RosselS Offline
                                        Sander Rossel
                                        wrote on last edited by
                                        #19

                                        There are cases where the opposite is also true... A table that will probably never get beyond a couple of 100's of records, but has a bigint as key :rolleyes:

                                        It's an OO world.

                                        public class Naerling : Lazy<Person>{}

                                        V P 2 Replies Last reply
                                        0
                                        • P Pascal Ganaye

                                          The sad thing is that it is one column in a 300 pages specification. The guy who do the specifications often do not have the technical expertise to know that a 16 bit integer can store 32000 values in 2 bytes. The programmer usually does, but the programmer is part of the chain. Every programmer is confronted to this problem at times. Do I raise the issue? If you raise the issue it will waste a few hours and you might end up finishing your development late. Also If you raise issues a bit too often you're quickly categorized as annoying git who can't follow orders. This is not the best way to progress in a company. I am not sure if this is true in India but this is true in the countries I worked in. If you shut up and follow orders, you won't get blamed and if you're on time you'll perhaps be promoted. The blame goes on the guy who did the specs despite the fact that the programmer is the best person to notice and fix the issue. To me this is the waterfall drama.

                                          Sander RosselS Offline
                                          Sander RosselS Offline
                                          Sander Rossel
                                          wrote on last edited by
                                          #20

                                          That is exactly how our database recently got some tables with ten columns of which seven were primary key (among which a varchar(50)). The tables were closely connected, but no foreign key was made anywhere. EVERY table (out of approximately 10) had the same redundant data stored along some other data unique to that table. All in all a true DB horror. The guy who made it is supposed to be our 'new' SQL expert, but simply followed the specs... :(( Luckily another programmer noticed and raised the issue to me. That's when I did not only raise the issue, but I raised hell as well! :-O Needless to say, the tables are being re-designed :-\

                                          It's an OO world.

                                          public class Naerling : Lazy<Person>{}

                                          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