Re: auto increment

From: Devrim GUNDUZ <devrim(at)commandprompt(dot)com>
To: Mehmet Uysal <mehmath(at)gmail(dot)com>
Cc: PostgreSQL Türkiye -Genel <pgsql-tr-genel(at)PostgreSQL(dot)org>
Subject: Re: auto increment
Date: 2006-02-28 01:01:51
Message-ID: 1141088511.3951.14.camel@evim.gunduz.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-tr-genel

Merhaba,

On Tue, 2006-02-28 at 02:51 +0200, Mehmet Uysal wrote:
> sorum şu,
> mysql ve mssql de genellikle tablo id leri için kullandıgımız auto
> increment özelliği postgresql de biraz değişik galiba, başka bir yolu
> varmı bilmiyorum ama ben sequence oluşturarak yaptım. burada problem
> olup olmayacağını henüz kestiremediğim ve alışık olmadıgım bi durum
> var, şöyle;
> oluşturdugum sequence de max min ve artış değerlerini belirttim ancak
> bunu birkaç tabloda kullandığımda artan ID ler , mesela kullanıcı
> tablosunda en son 20 eklendi , sonra mesaj tablosuna yeni veri
> eklendiğinde mesaj id si 21 oluyor ve tekrar kullaniciya veri
> eklendiğinde kullanicidaki ID 21 i atlayarak 22 ye yani sequence in
> kaldıgı yerden devam ediyor.

Evet bu durumdaki davranışı doğru. Hepsi için tek sequence
kullanıyorsunuz çünkü.

> şimdi bu kullanımda herhangi bir problem yaşanırmı onu sormak
> istiyorum veya her tablo için sequence mi oluşturmam daha mantıklı
> olur. bunların dışında başka bir çözüm yolu var mı?

Sequence mantığına ters bir durum var bence burada. Kişisel düşüncem her
tabloya ayrı bir seq tanımlamanız.

Saygılar.
--
The PostgreSQL Company - Command Prompt, Inc. 1.503.667.4564
PostgreSQL Replication, Consulting, Custom Development, 24x7 support
Managed Services, Shared and Dedicated Hosting
Co-Authors: PL/php, plPerlNG - http://www.commandprompt.com/

In response to

Responses

Browse pgsql-tr-genel by date

  From Date Subject
Next Message Esref Atak 2006-02-28 01:19:51 Re: auto increment
Previous Message Mehmet Uysal 2006-02-28 00:51:44 auto increment