salut
Am un "table" cu vreo 2mil de inregistrari. Vreau sa optimizez cautarea
Structure e cam asa:
CREATE TABLE table1
(
[tag_id] [numeric](18, 0) IDENTITY(1,1) NOT NULL,
[content_id] [numeric](18, 0) NULL,
[paragraph_nr] [int] NULL,
[sentence_nr] [int] NULL,
[word_nr] [int] NULL,
[word_type] [int] NULL,
[word_id] [numeric](18, 0) NULL,
[word_name] [varchar](100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[word_lemma] [varchar](100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[word_lemma_id] [numeric](18, 0) NULL,
[tag_type_id] [tinyint] NULL,
[word_tag] [varchar](3) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[word_group_1_id] [tinyint] NULL,
[word_group_1_id_nr] [tinyint] NULL,
[word_group_2_id] [tinyint] NULL,
[word_group_2_id_nr] [tinyint] NULL,
[ses_user_id] [numeric](18, 0) NULL,
[tag_ref_id] [numeric](18, 0) NULL,
[tag_scope_id] [tinyint] NULL,
[word_count] [numeric](18, 0) NULL,
[word_count_content] [numeric](18, 0) NULL,
[tag_length] [int] NULL,
[word_type_score] [numeric](18, 0) NULL,
CONSTRAINT [PK_tagging] PRIMARY KEY CLUSTERED
(
[tag_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]
END
Ai am niste proceduri care fac selecturi de genul:
INSERT INTO table2 (ws_id, content_id)
SELECT @term_id, tag_ref_id FROM table1 WHERE tag_type_id = 0 AND word_lemma = @term
GROUP BY tag_ref_id
Ce optimizari pot face? Am primit o recomandare sa folosesc "partitioned table/index"
Voi ce mi-ati recomanda?
Multumesc!