由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
JobHunting版 - SQL fast search in a 10 million records table
相关主题
SQL 面试问题求教一个SQL的问题
SQL find distinct values in large table (转载)compare two large tables SQL
SQL multiply all values of a column in table (转载)SQL add some columns into a table from another table
SQL combine two columns from two different tables no shared columns问一道在sorted array里search的问题
这道FB题如何解?keep group of values of SQL procedure in one table (转载)
请帮忙回答一个SQL问题问个sql问题
count unique values in file with 1 million rows (转载)[算法] unsorted array
请教个SQL的问题如何用R处理大文件 (转载)
相关话题的讨论汇总
话题: value话题: column话题: table话题: search话题: sql
进入JobHunting版参与讨论
1 (共1页)
l******9
发帖数: 579
1
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
f********d
发帖数: 51
2
as long as value is a clustered index, it should be fine.
doesn't matter if it's unique or not. (actually it shouldn't be unique)
1 (共1页)
进入JobHunting版参与讨论
相关主题
如何用R处理大文件 (转载)这道FB题如何解?
matrix 0 1组成,找最大的1组成的cluster请帮忙回答一个SQL问题
算法一问count unique values in file with 1 million rows (转载)
~~问两道AMAZON电面题请教个SQL的问题
SQL 面试问题求教一个SQL的问题
SQL find distinct values in large table (转载)compare two large tables SQL
SQL multiply all values of a column in table (转载)SQL add some columns into a table from another table
SQL combine two columns from two different tables no shared columns问一道在sorted array里search的问题
相关话题的讨论汇总
话题: value话题: column话题: table话题: search话题: sql