Einzelnen Beitrag anzeigen

romber

Registriert seit: 15. Apr 2004
Ort: Köln
1.166 Beiträge
 
Delphi 10 Seattle Professional
 
#20

AW: Tabelle optimieren???

  Alt 19. Okt 2010, 15:12
Hier ist meine Tabelle:

Code:
USE [SCHWACKE]
GO

SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[SCHWACKE_TDATA](
   [id] [int] IDENTITY(1,1) NOT FOR REPLICATION NOT NULL,
   [ic_datetime] [datetime] NULL,
   [p_preis] [int] NOT NULL,
   [f_typ] [smallint] NOT NULL,
   [f_zustand] [smallint] NOT NULL,
   [f_art] [smallint] NULL,
   [f_unfall] [bit] NOT NULL,
   [f_marke_modell_variante] [nvarchar](300) NULL,
   [f_marke_id] [smallint] NOT NULL,
   [f_marke] [nvarchar](50) NOT NULL,
   [f_modell_id] [smallint] NULL,
   [f_modell] [nvarchar](100) NULL,
   [f_variante] [nvarchar](100) NULL,
   [f_garantie] [bit] NULL,
   [f_km_stand] [int] NULL,
   [f_kategorie] [smallint] NULL,
   [f_ez_monat] [smallint] NULL,
   [f_ez_jahr] [smallint] NULL,
   [f_vorbesitzer] [smallint] NULL,
   [f_baujahr] [smallint] NULL,
   [f_leistung_kw] [smallint] NULL,
   [f_leistung_ps] [smallint] NULL,
   [f_getriebeart] [smallint] NULL,
   [f_kraftstoffart] [smallint] NULL,
   [f_schadstoffklasse] [smallint] NULL,
   [f_umweltplakette] [smallint] NULL,
   [f_farbe] [smallint] NULL,
   [f_hersteller_farbe] [nvarchar](100) NULL,
   [f_metallic] [bit] NOT NULL,
   [f_interieur_farbe] [nvarchar](100) NULL,
   [f_interieur_stoff] [smallint] NULL,
   [f_tueren] [smallint] NULL,
   [f_klimatisierung] [smallint] NULL,
   [f_hu_monat] [int] NULL,
   [f_hu_jahr] [int] NULL,
   [f_hsn] [nvarchar](7) NULL,
   [f_tsn] [nvarchar](7) NULL,
   [f_beschreibung] [ntext] NULL,
   [f_ausstattungen] [nvarchar](300) NULL,
   [f_xml] [ntext] NOT NULL,
 CONSTRAINT [PK_SCHWACKE_TDATA] PRIMARY KEY CLUSTERED
(
   [id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

GO
In den WHERE-Teil werden nur folgende Felder einbezogen:

Code:
[p_preis] [int] NOT NULL,
[f_typ] [smallint] NOT NULL,
[f_zustand] [smallint] NOT NULL,
[f_art] [smallint] NULL,
[f_unfall] [bit] NOT NULL,
[f_marke_id] [smallint] NOT NULL,
[f_modell_id] [smallint] NULL,
[f_km_stand] [int] NULL,
[f_kategorie] [smallint] NULL,
[f_ez_monat] [smallint] NULL,
[f_ez_jahr] [smallint] NULL,
[f_leistung_kw] [smallint] NULL,
[f_getriebeart] [smallint] NULL,
[f_kraftstoffart] [smallint] NULL,
[f_farbe] [smallint] NULL,
[f_klimatisierung] [smallint] NULL
Für folgende Felder habe ich einzelne Indizies erstellt (nonclustered):

Code:
[p_preis] [int] NOT NULL,
[f_typ] [smallint] NOT NULL,
[f_art] [smallint] NULL,
[f_marke_id] [smallint] NOT NULL,
[f_modell_id] [smallint] NULL,
[f_km_stand] [int] NULL,
[f_kategorie] [smallint] NULL,
[f_leistung_kw] [smallint] NULL,
[f_getriebeart] [smallint] NULL,
[f_kraftstoffart] [smallint] NULL,
[f_farbe] [smallint] NULL,
[f_klimatisierung] [smallint] NULL
Den Feldern

Code:
[f_ez_monat] [smallint] NULL,
[f_ez_jahr] [smallint] NULL
habe ich einen gemeinsamen Index verpasst.

Geändert von romber (19. Okt 2010 um 15:15 Uhr)
  Mit Zitat antworten Zitat