List:General Discussion« Previous MessageNext Message »
From:Moon's Father Date:October 24 2008 6:53am
Subject:Re: simple design choice
View as plain text  
If you want to choose the first one, then the flag' data type must be
enum.For int fill the disk with 4 byte and enum just 1 byte.
On Sat, Oct 4, 2008 at 2:15 AM, Alex K <spaceoutlet@stripped> wrote:

> That seems like a nice trick. I suppose the flag would just be an int
> and not an enum in this case.
>
> 2008/10/3 Mr. Shawn H. Corey <shawnhcorey@stripped>:
> > On Fri, 2008-10-03 at 09:58 -0700, Rob Wultsch wrote:
> >> On Fri, Oct 3, 2008 at 9:49 AM, Alex K <spaceoutlet@stripped> wrote:
> >> > Hello,
> >> >
> >> > I have a table of a 1 million users. I want to add a flag called
> >> > delete if a user wants to delete his account. Note that this situation
> >> > does not happen a lot.
> >> >
> >> > 1) Should I alter my users table and add a delete flag to the users
> table.
> >> >>> it's easy to update however it uses a lot of unnecessary
> space.
> >> >
> >> > 2) Should I create a new table user_id, flag already prefilled with
> >> > all user_ids.
> >> >
> >> > 3) Should I create a new table called deleted_users that has a user_id
> >> > if this user wants to be deleted.
> >> >>> it's hassle to update but takes into consideration the
> spareness of
> the data.
> >> >
> >> > Thank you,
> >> >
> >> > Alex
> >>
> >> #1 Define uses a lot of unnecessary space. I would imagine it would
> >> add not much more than 1 MB to the size of db, depending on column
> >> choice. A decent choice I think.
> >>
> >> #2 Yuck.
> >>
> >> #3 A compact and clean solution.
> >>
> >
> > If you're going to do #1, make the new column "status", with two states:
> > active and deleted.  In the future you can add more states without
> > re-doing your tables again.
> >
> >
> > --
> > Just my 0.00000002 million dollars worth,
> >  Shawn
> >
> > Linux is obsolete.
> > -- Andrew Tanenbaum
> >
> >
> > --
> > MySQL General Mailing List
> > For list archives: http://lists.mysql.com/mysql
> > To unsubscribe:
> http://lists.mysql.com/mysql?unsub=1
> >
> >
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:
> http://lists.mysql.com/mysql?unsub=1
>
>


-- 
I'm a MySQL DBA in china.
More about me just visit here:
http://yueliangdao0608.cublog.cn

Thread
simple design choiceAlex K3 Oct
  • Re: simple design choiceAlex K3 Oct
  • Re: simple design choiceRob Wultsch3 Oct
    • Re: simple design choiceMr. Shawn H. Corey3 Oct
      • Re: simple design choiceAlex K3 Oct
        • RE: simple design choiceUS Data Export3 Oct
        • Re: simple design choiceMoon's Father24 Oct
  • RE: simple design choiceMartin Gainty3 Oct
  • Re: simple design choiceFish Kungfu3 Oct
    • Re: simple design choiceAndy Shellam3 Oct