由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - SQL fast search in a 10 million records table (转载)
相关主题
SQL add some columns into a table from another table (转载Truncation error import csv file to SQL table (转载)
我的DBA在生成ORACLE table的时候需要一个一个column看 (转载)技术问题探讨:数据处理
一FG家常见题 (转载)SQL question
请问如何用sort命令给数据排序? (转载)问个SQL的问题
Help: How to extract the numberic value in a sentence?一个SQL的题目
简单算法问题mysql DB - 怎么能很容易地update data? (转载)
How to sort a map in C++ STL based on Value, instead of Keycassandra query speed求助
问个hash table问题请教大家一个LINQ to SQL 的 query
相关话题的讨论汇总
话题: value话题: column话题: table话题: search话题: sql
进入Programming版参与讨论
1 (共1页)
l******9
发帖数: 579
1
【 以下文字转载自 JobHunting 讨论区 】
发信人: light009 (light009), 信区: JobHunting
标 题: SQL fast search in a 10 million records table
发信站: BBS 未名空间站 (Thu Jul 24 23:26:56 2014, 美东)
I need to do a fast search in a column with floating point numbers in a
table of SQL server 2008 R2 on Win 7.
the table has 10 million records.
e.g.
Id value
532 937598.32421
873 501223.3452
741 9797327.231
ID is primary key, I need o do a search on "value" column for a given value
such that I can find the 5 closest points to the given point in the table.
The closeness is defined as the absolute value of the difference between the
given value and column value.
The smaller value, the closer.
I would like to use binary search.
I want to set an unique index on the value column.
But, I am not sure whether the table will be sorted every time when I search
the given value in the column ?
Or, it only sorts the table one time because I have set the value column as
unique index ?
Are there better ways to do this search ?
Any help would be appreciated.
thanks
c*****a
发帖数: 1638
2
it will only sort one time when you create index.

【在 l******9 的大作中提到】
: 【 以下文字转载自 JobHunting 讨论区 】
: 发信人: light009 (light009), 信区: JobHunting
: 标 题: SQL fast search in a 10 million records table
: 发信站: BBS 未名空间站 (Thu Jul 24 23:26:56 2014, 美东)
: I need to do a fast search in a column with floating point numbers in a
: table of SQL server 2008 R2 on Win 7.
: the table has 10 million records.
: e.g.
: Id value
: 532 937598.32421

1 (共1页)
进入Programming版参与讨论
相关主题
请教大家一个LINQ to SQL 的 queryHelp: How to extract the numberic value in a sentence?
[SQL求助] 取每个group的第一个record简单算法问题
underlying sort algorithm for SET in STL?How to sort a map in C++ STL based on Value, instead of Key
A STL sorting algorithm problem问个hash table问题
SQL add some columns into a table from another table (转载Truncation error import csv file to SQL table (转载)
我的DBA在生成ORACLE table的时候需要一个一个column看 (转载)技术问题探讨:数据处理
一FG家常见题 (转载)SQL question
请问如何用sort命令给数据排序? (转载)问个SQL的问题
相关话题的讨论汇总
话题: value话题: column话题: table话题: search话题: sql