Hi,

I am developing a large database where the web interface may be shared
among many companies, but the data will generally not be shared.  For
the purposes of example, let's call it a bug tracking system such as
Bugzilla.  Each company has their own private software bugs.

Many companies may enter bugs that become part of the "bugs" table.
However, depending on how a user is logged in (i.e. is part of which
company) only that company's bugs will be queried or visible.

If I just index the bugs with an autoincrement long integer and an
integer representing the company, it will work fine.  The
disadvantage, however, is that people generally expect that after they
enter Bug #567, Bug #568 comes next (which wouldn't be the case if the
index of the "bugs" table is shared among all companies).

What is the most efficient way to tackle this problem so that each
company gets their own virtual private space of bug numbers but only
one "bugs" table is used?

The most obvious way to handle it is:

a)Lock the table.

b)Find the maximum bugnumber where company=X.

c)Insert the new bug with company=X and bugnumber=max+1.

d)Unlock the table.

However, is there a better way to think about this?

Thanks, Dave.

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to