Results 1 to 6 of 6

Thread: MYSQL question - size of field

  1. #1
    Not that blue at all Blue Cat Buxton's Avatar
    Join Date
    May 2004
    Location
    UK
    Posts
    932

    MYSQL question - size of field

    I have a table to store merchant offers that updates via a script - eventually every night.

    The first thing the script does is delete all the existing offers from that supplier then pull in the current offers.

    Each offer has an id which is auto incremented.

    The total number of rows in the table is unlikely to get above a few thousand, but the id is already up to tens of thousands and will rise quickly to millions - will this cause any problems, or should i periodically drop and recreate the table, and zero the id column?

  2. #2
    Registered Joachim's Avatar
    Join Date
    Feb 2005
    Posts
    64
    An unsigned int goes up to 4,294,967,295 if that's not enough and
    you have the option of clearing out the table I would suggest todo so.

    While i'm not really a mysql guy, I assume mysql has similar ways to (re)analyze your indexes. If you have such a large volume of transactions it might be wise
    to research that to get optimal performance out of your database.

    The following command will clear the table's data and reset the sequence.
    truncate table <tablename>;

  3. #3
    Registered Member moonshield's Avatar
    Join Date
    Aug 2004
    Location
    Charlotte
    Posts
    1,281
    periodically drop and recreate the table, and zero the id column?

    You really don't have to go that far, just use an UPDATE instead of an INSERT.

  4. #4
    Not that blue at all Blue Cat Buxton's Avatar
    Join Date
    May 2004
    Location
    UK
    Posts
    932
    Quote Originally Posted by Joachim
    An unsigned int goes up to 4,294,967,295
    I guess it will take a while to get that high!

    Quote Originally Posted by thepoorman
    You really don't have to go that far, just use an UPDATE instead of an INSERT.
    I cant update because I dont link/relate the entry to the merchants data. Data feeds seem all overthe place, no consistency so it is really difficult in getting the merchants data to match up with sensible field names, which is why I just delete the existing data and start from scratch.

    Quote Originally Posted by thepoorman
    periodically drop and recreate the table, and zero the id column?
    I think I will do this, but i do need to lookinto database optimisation some more

    Thanks for the replies

  5. #5
    Registered Joachim's Avatar
    Join Date
    Feb 2005
    Posts
    64
    Not sure if you got it but ....

    There's no need to drop/recreate the table.

    Just use the truncate table statement and your
    auto-increment field will reset to zero.

  6. #6

Similar Threads

  1. Replies: 2
    Last Post: 02-20-2005, 11:30 PM
  2. Replies: 0
    Last Post: 01-30-2005, 08:33 PM
  3. Replies: 8
    Last Post: 11-12-2004, 04:10 PM
  4. mysql
    By thebillionaire in forum Community Management
    Replies: 11
    Last Post: 08-02-2004, 12:24 PM
  5. changing a field type in mysql
    By eMEraLdwPn in forum Website Programming & Databases
    Replies: 2
    Last Post: 02-06-2004, 10:13 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •