Search Postgresql Archives

Re: "Keyed" sequence?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



-----------------------------------------------
Israel Brewster
Systems Analyst II
Ravn Alaska
5245 Airport Industrial Rd
Fairbanks, AK 99709
(907) 450-7293
-----------------------------------------------


BEGIN:VCARD
VERSION:3.0
N:Brewster;Israel;;;
FN:Israel Brewster
ORG:Frontier Flying Service;MIS
TITLE:PC Support Tech II
EMAIL;type=INTERNET;type=WORK;type=pref:israel@xxxxxxxxxxxxxxxxxx
TEL;type=WORK;type=pref:907-450-7293
item1.ADR;type=WORK;type=pref:;;5245 Airport Industrial Wy;Fairbanks;AK;99701;
item1.X-ABADR:us
CATEGORIES:General
X-ABUID:36305438-95EA-4410-91AB-45D16CABCDDC\:ABPerson
END:VCARD
 

> On Apr 28, 2016, at 11:01 AM, Vik Fearing <vik@xxxxxxxxxxxxxx> wrote:
> 
> On 04/28/2016 08:48 PM, Israel Brewster wrote:
>>> 
>>> On Apr 28, 2016, at 10:39 AM, Vik Fearing <vik@xxxxxxxxxxxxxx> wrote:
>>> 
>>> What would be the point of this?  Why not just one sequence for all
>>> departments?
>> 
>> continuity and appearance, not to mention simple logical progression. In this case, the sequence is being used to generate a PO number. Company style indicates that a PO number is a department code followed by a unique number. With one sequence for all departments, you could (will) end up with discontinuous PO numbers in any given department. It would be nice if, after issuing PO number 15-1, the next PO in department 15 was 2, if for no other reason than the accounting department could easily see that they aren't missing any. With one sequence, there will quite likely not be a PO number 2 for any given department, so that department has no easy way to keep track of their PO's based on PO number.
> 
> You're not guaranteed that even with individual sequences.

True, in the event that an insert fails or the like, there would be a gap of one number. However, with a single sequence you are guaranteed to have gaps, and guaranteed that they will be significant.

> 
> What' you're looking for is a gapless sequence, which is best simulated
> with a table.  In your case, I'd just add a column to your existing
> departments table holding the next number to use.

Yeah, that looks like it could be the way to go. Thanks.

> 
> It'll kill your performance, but if aesthetics are that important to you...

They're not *that* important. I was just asking if there was a way to do this easily.

> -- 
> Vik Fearing                                          +33 6 46 75 15 36
> http://2ndQuadrant.fr     PostgreSQL : Expertise, Formation et Support
> 
> 
> -- 
> Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux