Re: [users@httpd] MySQL versus Postgres Auto Increment

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

 



On 10/18/05 11:12 PM, "Michael Avila" <mavila@xxxxxxxx> wrote:

> I have been reading the series of messages on MySQL versus Postgres. I have a
> couple of concerns myself. There is one that is important to me. Am I being
> paranoid or is there a good reason to be concerned? Here is my situation.
> 
> I have programmed a database in MySQL 4.x. The database could have about 5,000
> to 10,000,000 or more ids (depending upon the success of the project). With
> MySQL, incrementing the id column is very simple using the reserved word
> AUTO_INCREMENT. And retrieving the last id is very simple. With Postgres, I
> have been shown examples on how to do this but it is additional coding that I
> am not comfortable with. (As a matter of note, I have used MySQL quite a bit
> but have yet to fully use Postgres. I have been "stalling" using it more due
> to my unfamiliarity. That is my personal issue and I do recognize that I do
> need to dig in and do it.) In addition, I understand that in Postgres the
> numbers may not be sequential. I prefer that but it is not a requirement.
> However, I also hear that there is a limit on high the id number can go and
> that it can wrap around an get duplicate numbers.
> 
> So am I being paranoid? Is it really simple to accomplish the same thing in
> Postgres as I have done in MySQL? Will I have problems down the road with
> numbers trying to add themselves and then end up being duplicates?
> 
> My preference is to use Postgres over MySQL for several reasons. However, I am
> concerned that I may be getting in over my head with this auto increment and
> retrieving the last id number. Keep the flames. This is not a us versus them
> with MySQL versus Postgres. I really am trying to get comfortable with
> Postgres and am really seeking help. Suggestions and help are most certainly
> welcome. This is not a fault finding mission for either database. This is a
> database that may be used throughout the United States by a volunteer group.
> Getting it done correctly and being able to maintain it comfortably and
> quickly is VERY important to me.
> 
> Thank you in advance to those that reply with suggestions on how to be more
> comfortable with Postgres and how to make the auto increment in Postgres as
> easy to create and retrieve as in MySQL.
> 
> Mike

Mike,

I am not a programmer, but I do use databases and programming in my work.  I
also started with MySQL but started "experimenting" with postgresql about
1.5 years ago.  After I saw that the database concepts such as foreign keys,
referential integrity, and stored procedures were more than "things in a
book" and could be rapidly implemented in practice, I became very interested
in making the change.

The "serial" column really does work just like auto_increment with a few
minor adjustments.  Just use such a column once or twice to satisfy yourself
that it works on a small table with just an ID (serial column) and value.
Do manual inserts and queries of the underlying sequence.  It will just take
10 minutes of your time to be satisfied that you can do with postgres what
you were doing with mysql.

Sean


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx



[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux