It is simple so far - I'd just create an an index on both location and
name...
I am not quite understanding why a multi-column index won't work. Can you
explain a little more?
Here is what I was thinking:
create table entity(
type int,
location int,
name varchar(100) not null,
);
create unique index my_index on entity(location,name);
It seems as though an "and" query would run quickly. It also seems as though
if you needed to get a few records that were one of several names, a query
such as the following would run quickly:
select * from entity where location = 5 and (name = 'joe' or name='joseph');
or are the aliases a seperate attribute? I am not clear on exactly where the
alias comes in.
Well... Yes, that's the problem - aliases ARE a separate attribute. The SAME
entry could be known as both 'joe' and 'joseph', so, as far as I can see,
I have to choices to do this, as I explained earlier - either create two
tables, one having just entry id and location, and the other one, having
id, name and type (or 'nametype' if you will), liked to the first one, or,
I could have one table with multiple rows, corresponding to the same entry.