indexing - TOP 2 faster than TOP 1 in Sql Server? -
We have a table with + - 500k rows in the SQL Server 2005 database and a full text index from your columns. We were doing some tests and found that SELECT TOP 1 ... was taking longer than two minutes to return (full text column, 'anyValue'). Thank you, thank you!
> Edit: Some more information about the problem, SQL uses a remote scan on top 1 query plan , While the Top 2 uses index sequence. Very strange
Edit 2: These are both execution plans from Sql:.
Top 1
StmtText - ---------------------------- ---------------------- ---------------------------- ---------------------- ---------------------------- ----------------- | --Tap (top expression: ((1))). --Nested Loops (join the left half where: ([ECRReload] [dbo] [TECR_PRODUTO_COMPLETO_VENDAVEIS] [idProduto] = [full-text search engine] [KEY] ....)). --Index scan (object: ([ECRReload] [dbo] [TECR_PRODUTO_COMPLETO_VENDAVEIS] [ix_tecr_produto_completo_vendaveis01] ...)) | --remote scan (object: (included))
top 2
stemtext --------------------- --------------------------------------------------- --------------------------------------------------- --------------------------------------------------- --------------------------------------------------- ----------------------- --- | - Top (top precipitation: (2))). - Enhanced loops (inner join, over references: ([full-t ext search engine] [KEY])). --remote scan (object: (included)). --Index Research (Object: ... ([ECRReload] [dbo] [TECR_PRODUTO_COMPLETO_VENDAVEIS] [ix_tecr_produto_completo_vendaveis01]), Search: ([ECRReload]. [Dbo]. [TECR_PRODUTO_COMPLETO_VENDAVEIS]. [IdProduto] = [full-text search engine ]. [KEY]) forwarded
I'm not 100% sure if I can say That's fine, but it seems that last night our DBA rebuilt the fulltext list and reconstituted and started working on it. Both questions now go with less than a second.
Why can not I explain, but it is working.
Comments
Post a Comment