Wednesday, March 7, 2012

Help to store demo users

Hi,
My table stores around 30000 users, out of which around 5-10 are demousers.
Right now we are using the NOT IN Statement to list the original users
like
SELECT * FROM UserTable WHERE UserID NOT IN ( Demo User IDs)
I know this will affect performance. Right now i am planning to modify the
database design in order to avoid the use of NOT IN. i have two options
either to add a astatus field in the current table or to create a new table
for demo users. if i go for the second option, i need to use a UNION ALL
Statement to list all users , now if i am going for the first option, i need
to check the value of status in order to distinguish the different users.
Can anybody suggest the better solution ? Accessing two tables or Accessing
each row and checking the status.
Thanking in advance
LaraLara
We have a user table with 'vis' column which indicates 0 -demo and 1 -active
users
SELECT <column list> FROM Users WHERE vis=1
"Lara" <aneeshattingal@.hotpop.com> wrote in message
news:%23pGBySXUFHA.1044@.TK2MSFTNGP10.phx.gbl...
> Hi,
> My table stores around 30000 users, out of which around 5-10 are
demousers.
> Right now we are using the NOT IN Statement to list the original users
> like
> SELECT * FROM UserTable WHERE UserID NOT IN ( Demo User IDs)
> I know this will affect performance. Right now i am planning to modify the
> database design in order to avoid the use of NOT IN. i have two options
> either to add a astatus field in the current table or to create a new
table
> for demo users. if i go for the second option, i need to use a UNION ALL
> Statement to list all users , now if i am going for the first option, i
need
> to check the value of status in order to distinguish the different users.
> Can anybody suggest the better solution ? Accessing two tables or
Accessing
> each row and checking the status.
> Thanking in advance
> Lara
>|||But wiill that be better; or shall i use a seperate table.
"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:OcSy9WXUFHA.616@.TK2MSFTNGP12.phx.gbl...
> Lara
> We have a user table with 'vis' column which indicates 0 -demo and
1 -active
> users
> SELECT <column list> FROM Users WHERE vis=1
>
>
> "Lara" <aneeshattingal@.hotpop.com> wrote in message
> news:%23pGBySXUFHA.1044@.TK2MSFTNGP10.phx.gbl...
> demousers.
the
> table
> need
users.
> Accessing
>|||Lara
Why do you need to separate them? I don't know your business requirements.
Its good to have a status column to store the info.
"Lara" <aneeshattingal@.hotpop.com> wrote in message
news:%23TUzqaXUFHA.752@.TK2MSFTNGP10.phx.gbl...
> But wiill that be better; or shall i use a seperate table.
>
> "Uri Dimant" <urid@.iscar.co.il> wrote in message
> news:OcSy9WXUFHA.616@.TK2MSFTNGP12.phx.gbl...
> 1 -active
> the
options
ALL
i
> users.
>|||Separate Table wont help you becasue you would have the need to always
mantain your app or your procedural logic for these two ways. Thats really
odd. The best thing is like Uri says to flag these users as active or demo
suers.
HTH, Jens Suessmeyer.
"Lara" <aneeshattingal@.hotpop.com> schrieb im Newsbeitrag
news:%23TUzqaXUFHA.752@.TK2MSFTNGP10.phx.gbl...
> But wiill that be better; or shall i use a seperate table.
>
> "Uri Dimant" <urid@.iscar.co.il> wrote in message
> news:OcSy9WXUFHA.616@.TK2MSFTNGP12.phx.gbl...
> 1 -active
> the
> users.
>|||
> But wiill that be better; or shall i use a seperate table.
I prefer the separate table, in a schema like this:
Users = {ID, Name, ...}
Demo_Users = {ID}
Non_Demo_Users = VIEW ::
select * from Users where ID not in (select ID from Demo_Users)
-- Alex Papadimoulis

>
> "Uri Dimant" <urid@.iscar.co.il> wrote in message
> news:OcSy9WXUFHA.616@.TK2MSFTNGP12.phx.gbl...
> 1 -active
> the
> users.
>
>

No comments:

Post a Comment