List:General Discussion« Previous MessageNext Message »
From:Carsten Pedersen Date:April 22 2010 11:34am
Subject:Re: Auto Increment in InnoDB
View as plain text  
On Thu, 22 Apr 2010 13:12:16 +0200, Johan De Meersman <vegivamp@stripped>
wrote:
> Kudos for managing to drag up such an obscure piece of functionality :-)
I
> can see where it would be useful, though.
> 
> As to your question, though: given that that page indicates that it will
> reuse deleted sequence numbers, I think your best bet would be select
@id
> :=
> count(*)+1 from table where cluster='clusterA' AND file='fileA' ; -
should
> be slightly faster than a max(), I think. That in a trigger on your
table
> should emulate the behaviour pretty closely.

Wouldn't that strategy cause problems if one or more rows have been
deleted in the meantime? (i.e. sequence numbers 1-4 have been created, row
2 has been deleted - new sequence number would be 4).

/ Carsten

Thread
Auto Increment in InnoDBAveek Misra22 Apr
  • Re: Auto Increment in InnoDBJohan De Meersman22 Apr
    • Re: Auto Increment in InnoDBAveek Misra22 Apr
      • Re: Auto Increment in InnoDBJohan De Meersman22 Apr
        • Re: Auto Increment in InnoDBAveek Misra22 Apr
          • Re: Auto Increment in InnoDBJohan De Meersman22 Apr
            • Re: Auto Increment in InnoDBAveek Misra22 Apr
              • Re: Auto Increment in InnoDBJohan De Meersman22 Apr
            • Re: Auto Increment in InnoDBCarsten Pedersen22 Apr
              • Re: Auto Increment in InnoDBJohan De Meersman22 Apr
                • Re: Auto Increment in InnoDBChris W22 Apr
                  • Re: Auto Increment in InnoDBJohan De Meersman23 Apr
  • Re: Auto Increment in InnoDBmos22 Apr