Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / Databases / July 2005

Tip: Looking for answers? Try searching our database.

index already exists

Thread view: 
Dave Brown - 22 Jul 2005 09:44 GMT
Hi All,

I'm not sure whether i'm running into a problem with hsqldb or more
simply my understanding of SQL indexes is to pot.

I've got a number of table in a hsqldb, i.e  DIVES, LOCATIONS

My Locations table as a column called Location_ID which is its primary
key.  The DIVES table also has a column called Location_ID, so I know at
which location the Dives was at.

I want to create an index of the Location_ID in the dives table but when
I do a  "CREATE INDEX Location_ID on DIVES(Location_ID)"

I get back an "index already exists" error, it definately is NOT an
index in the DIVES table.  This is confusing me completely.  I'm using
DBVIsualizer as a GUI to maintain my HSQLDB tables.

Can anyone shed any light on why I'm getting this message back ?

Thanks,

Dave.
Bjorn Abelli - 22 Jul 2005 10:55 GMT
"Dave Brown" wrote...

> I've got a number of table in a hsqldb, i.e  DIVES, LOCATIONS
>
[quoted text clipped - 10 lines]
>
> Can anyone shed any light on why I'm getting this message back ?

So what is the name of the index of Location_ID on LOCATIONS?

Probably Location_ID, isn't it?

I suggest you simply try:

"CREATE INDEX Dives_Location_ID on DIVES(Location_ID)"

i.e. give the index a different name than the existing one...

// Bjorn A
Dave Brown - 22 Jul 2005 12:25 GMT
Ahh I see,  Would I have to specifically reference that new index name
in my select statements or would the database engine use it automatically.

Dave

> "Dave Brown" wrote...
>
[quoted text clipped - 24 lines]
>
> // Bjorn A
Bjorn Abelli - 22 Jul 2005 14:52 GMT
"Dave Brown" wrote...

> Ahh I see,  Would I have to specifically reference that new
> index name in my select statements or would the database
> engine use it automatically.

You shouldn't need to reference that index, as any DB with good optimization
rules should make use of any existing index if it can improve performance of
a select statement.

I don't know the inner workings of hsqldb, but what I can see after a quick
glance on its documentation, it should work just fine, without specific
references to the indexes.

// Bjorn A
Dave Brown - 22 Jul 2005 15:44 GMT
> "Dave Brown" wrote...
>
[quoted text clipped - 11 lines]
>
> // Bjorn A
Dave Brown - 22 Jul 2005 15:45 GMT
Ahh I see, Thanks Bjorn.

> "Dave Brown" wrote...
>
[quoted text clipped - 11 lines]
>
> // Bjorn A


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.