Re: [PHP] High ID (unique, auto increment) causes slow responses on PHP (MySQL)

[email protected] (Nitsan Bin-Nun)
Newsgroups php.general
Message-ID <[email protected]>
Just use SERIAL id and you will be good ;) (that's an alias for something
like BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY)

It shouldn't bother you as long as it works.

On Sat, Jun 13, 2009 at 9:16 PM, דניאל דנון <[email protected]> wrote:

>  I've built a certain system where every time new user enters it creates a
> "guest row" on "guests" table. he also gets an identifying cookie.
>
> The table contains several fields, one of them is ID which is auto
> increment
> and unique
>
> When he does a certain action it gets recorded in the "done_action" table
> with several fields on it, one of them is "guest_id" and his ID on it.
>
>
> Problem is the guests table has about 30,000 rows (which means ID is high).
>
>  I was wondering whether I should somehow change how the system works.
>
> I've thought about couple of options
>
> A weekly "cleanup" job. opens a table called "guests_tmp", *copies* all
> data
> from guests to guests_tmp.
>
> every row it copies it also changes the ID on the table done_action.
>
> What do you  think?
>
>
> --
> Use ROT26 for best security
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.