我应该使用什么类型的索引类型

时间:2015-07-14 07:36:00

标签: sql-server tsql indexing

我有一个包含varchar(6),datetime和两个浮点数的表。它有超过3000万条记录

varchar和datetime用作具有超过500k记录的表的连接条件,以及结果中使用的两个浮点数的总和和平均值。

我正在接受索引建议以加快速度。

有112个唯一的varchar值,以及525k个唯一的日期时间值。

加入条件为import javax.swing.JOptionPane; public class Temp3 { public static void main(String[] args) { // String sentence = "This is a Java program for converting // temperatures."; String [] options = {"Convert from Celsius to fahrenheit", "Convert from Fahrenheit to Celsios","Exit"}; int choice=0; do{ //do while is used so that the loop will run AT LEAST ONCE choice = JOptionPane.showOptionDialog(null,"What do you want to do?", "Choose an option", JOptionPane.YES_NO_CANCEL_OPTION, //option type JOptionPane.QUESTION_MESSAGE, null, options, options[0]); convertTemp(choice); }while(choice!=2); } private static void convertTemp(int choice) { // TODO Auto-generated method stub String from = "", to = ""; if(choice==0){ //set to and form so that you don't need to type the units again and again from="Celsius"; to ="Fahrenheit"; }else if(choice==1){ to="Celsius"; from ="Fahrenheit"; }else{ JOptionPane.showMessageDialog(null,"Goodbye","Exit",JOptionPane.INFORMATION_MESSAGE); //I often put message type to make it more presentable return; //exit method :) } Float tempFrom= Float.parseFloat(JOptionPane. showInputDialog("You are now converting from "+from+" to "+ to+"." + "Please enter degrees in "+from +".")); //get input while(tempFrom<-100 ||tempFrom>100){ //check if input is valid if(tempFrom>100){ tempFrom = Float.parseFloat(JOptionPane.showInputDialog(null, "That number is too high. " + "Please enter a temperature between -100 & 100 degress "+from , "Temperature too high" , JOptionPane.ERROR_MESSAGE));//inform the user about the error and ask for the input at the same time }else{ tempFrom = Float.parseFloat(JOptionPane.showInputDialog(null, "That number is too low. " + "Please enter a temperature between -100 & 100 degress "+from , "Temperature too low" , JOptionPane.ERROR_MESSAGE));//inform the user about the error and ask for the input at the same time } } double answer =0; if(choice==0){ //celsius to fahrenheit answer = (tempFrom * 1.8) + 32; }else{ //fahrenheit to celsius answer = (tempFrom- 32) / 1.8; } JOptionPane.showMessageDialog(null, "The temperature in "+ to +" is " + answer ,to, JOptionPane.INFORMATION_MESSAGE); } }

我一直在玩聚类,非聚簇,复合和覆盖索引的各种组合,但我不是真正的专家,所以我很欣赏人们的意见。

我的主要问题是这里首选的聚集或非聚集索引,为什么?覆盖指数更好,为什么?

我在改变事物的过程中看到了对执行路径的各种更改,但我不知道具有嵌套循环的Eager Index Spool是否优于散列匹配。

欢呼任何帮助。

0 个答案:

没有答案