Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

Sometimes, IDENTITY columns are a Bad Thing for uniqueness (AKA, why I like uuid instead). Why? Well, three reasons IMHO.

  1. They're finite. Let's take a shopping cart as a simple example. If I have an IDENTIY/AUTOINC column for each item added, that adds up over time. Will I max out that BIGINT field? Eventually. Granted it may be a loooong time down the road, but why build in that limitation to begin with?

  2. Uniqueness. :-) What's the difference between row 243 in one table and row 243 in another table? Sometimes, nothing except their uuid. For example: db data change logs in an app. If each row has a unique id, then I can use it as a foreign key in the log data table. Sure I could use numbers, but uuids provide a little more assurence that the foreign key IS correct, instead of coincidentally matching by number.

  3. Sometimes, IDENTITY/AUTOINC columns are pure evil. I've seen on more than one occasion that the ident/autoinc seed for a table gets reset, after which time the next IDENTITY number may actually be from a record that was previously deleted. Next thing you know a join is fubar just because a new entry aquired an old identity seed. It shouldn't happen, but it does sometimes.

My point? Good question. :-P

In reply to Re: Re: Re: Re: Safe for SQL by jk2addict
in thread Safe for SQL by Anonymous Monk

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?

What's my password?
Create A New User
Domain Nodelet?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (3)
As of 2021-10-19 20:55 GMT
Find Nodes?
    Voting Booth?
    My first memorable Perl project was:

    Results (77 votes). Check out past polls.