Subject [firebird-support] Perfomance differences
Author Alexander Gräf
> -----Ursprüngliche Nachricht-----
> Von: "Carsten Schäfer" [mailto:ca_schaefer@...]
> Gesendet: Freitag, 26. November 2004 14:28
> An: firebird-support@yahoogroups.com
> Betreff: Re: [firebird-support] Perfomance differences
>
> How can i name the indice Firebird creates for primary key
> and foreign keys ?

Some examples from a SQL file:

CREATE TABLE "Tracks" (
"TrackID" UniqueID NOT NULL CONSTRAINT "PKY_Tracks" PRIMARY KEY,
"Version" Version,
"AlbumID" UniqueID NOT NULL CONSTRAINT "FKY_Tracks_Albums" REFERENCES "Albums"
ON DELETE CASCADE
ON UPDATE CASCADE,
"Disc" EntityName,
"Ordinal" Ordinal NOT NULL,
"Title" EntityInfo NOT NULL,
"Artist" EntityInfo,
"Extended" EntityInfo,
"Lyrics" LongText,
"Duration" Quantity,
"Bitrate" Quality,
"Deleted" Boolean DEFAULT 0,
"PlayCount" Quantity DEFAULT 0,
"Modified" TimestampNow,
CONSTRAINT "UNQ_TracksDisc" UNIQUE ("AlbumID", "Disc", "Ordinal")
);

CREATE INDEX "IDX_Tracks_Title" ON "Tracks" ("Title");
CREATE INDEX "IDX_Tracks_Artist" ON "Tracks" ("Artist");
CREATE INDEX "IDX_Tracks_Disc" ON "Tracks" ("Disc");
CREATE INDEX "IDX_Tracks_Ordinal" ON "Tracks" ("Ordinal");
CREATE INDEX "IDX_Tracks_PlayCount" ON "Tracks" ("PlayCount");


CREATE TABLE "PlaylistItems" (
"PlaylistID" UniqueID NOT NULL CONSTRAINT "FKY_PlaylistItems_Playlists" REFERENCES "Playlists"
ON DELETE CASCADE ON UPDATE CASCADE,
"Ordinal" Ordinal NOT NULL,
"TrackID" UniqueID CONSTRAINT "FKY_PlaylistItems_Tracks_Tracks" REFERENCES "Tracks"
ON DELETE CASCADE ON UPDATE CASCADE,
"AlbumID" UniqueID CONSTRAINT "FKY_PlaylistItems_Albums" REFERENCES "Albums"
ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT "PKY_PlaylistItems" PRIMARY KEY ("PlaylistID", "Ordinal"),
CONSTRAINT "CHK_PlaylistItems_NotNull"
CHECK (COALESCE("TrackID", "AlbumID") IS NOT NULL),
CONSTRAINT "CHK_PlaylistItems_SingleValue"
CHECK (("TrackID" IS NULL AND "AlbumID" IS NOT NULL) OR ("TrackID" IS NOT NULL AND "AlbumID" IS NULL))
);

CREATE INDEX "IDX_PlaylistItems_Ordinal" ON "PlaylistItems" ("Ordinal");


Hope thats enough to see how nearly every element in the database/tables can get a user defined name.

Regards, Alex