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

Re: [extremeperl] refactoring databases

Expand Messages
  • Rob Nagler
    ... Yes, we try our best to automate everything. If we think there is going to be multiple upgrades, one of which is critical, we ll organize these in
    Message 1 of 11 , Feb 19, 2005
    • 0 Attachment
      Johan Lindstrom writes:
      > > > Sometimes one can prepare the migration and just do the most critical part
      > > > during the downtime.
      > >
      > >We try to do this, too.
      >
      > Do you automate these steps also?

      Yes, we try our best to automate everything. If we think there is
      going to be multiple upgrades, one of which is critical, we'll
      organize these in separate releases. If this isn't possible, we'll
      make it a two-part upgrade. That script I included in a previous
      message doesn't update the db_upgrade_t if you just call one of the
      methods.

      > Does that mean you don't share identities between tables at all? Just one
      > global sequence (or whatever)?

      Not exactly. The following describes it in detail:

      http://petshop.bivio.biz/src?s=Bivio::Type::PrimaryId

      This the base class of all serial keys. A PrimaryId is a NUMERIC(18)
      (but could be larger) which looks like:

      18 5 3 2 0
      +------------------+-------------+----------+-------+
      | Monotonically | Site Id or | Mistake | Type |
      | Increasing Seq | Other info | Bit | |
      +------------------+-------------+----------+-------+

      The numbers above are digit index. Type is a number that uniquely
      identifies the key type. This divides the name space. The Site Id
      allows you to divide the name space across independent databases. The
      Mistake Bit allows you to make mistakes. :-) We used it in one case
      to transform one key into another without changing the type It saved
      a lookup, and was related to finding the start of a tree for Oracle's
      CONNECT BY. Now they we are dumping CONNECT BY, we have no need for
      it. But that's another discussion.

      Here's how we initialize the sequences:

      CREATE sequence user_s
      MINVALUE 100001
      CACHE 1 INCREMENT BY 100000
      /

      CREATE SEQUENCE club_s
      MINVALUE 100002
      CACHE 1 INCREMENT BY 100000
      /

      CREATE SEQUENCE ec_payment_s
      MINVALUE 100015
      CACHE 1 INCREMENT BY 100000
      /

      CREATE sequence bulletin_s
      MINVALUE 100016
      CACHE 1 INCREMENT BY 100000
      /

      As you can see the spaces are unique, but overlapping. Some people
      might complain it junks up the indexes, but we haven't seen that to be
      a problem. Once the tables get big enough, it really doesn't matter.

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