Best Index type for low variability columns like Country or LastName

Hi, 
What would be best Index to use on Low variability columns like Country or LastName in SQL Server.
I think BitMap index we can use only on columns where we can have two possible value like male/female.

basically I was trying to figure out if there is any kind of Indexes in SQL Server which have special design for low variability column. 
my example queries like :  select a,b,c from table t where country = 'USA'
Hi Eshant,
In your scenario, you need to know which index is the best Index to use on Low variability columns like Country or LastName in SQL Server. As per my understanding, the performance not only related to the types of index on that column, but also related
to the records on your table.
Here is blog which tests the performance for different types of index on variability column like lastname, please refer to the link below.
http://www.codeproject.com/Articles/234399/Database-performance-optimization-part-Indexing
Regards,
Charlie Liao
If you have any feedback on our support, please click
here.
Charlie Liao
TechNet Community Support

Similar Messages

  • WHat is the best index type for non uniqueness / Varchar columns in SQL 2008 R2

    Hello All Greetings,
    Please help me here with my doubt,
    in my table i have two columns about a million rows, it has about 20 columns in it, three columns with name as Period, Gender so most of the time these two columns use in where clause,
    Gender  will contain Either M or F , Period contains YYYY-Month (2013-December, 2013-August) etc so i would like to add a Index to these two columns so that in will increase the performance, so please let me know what type of indexes i need to add to
    these columns in the table,
    please note that only one time we will add data to the table which will take only 2 minutes but we query the table every day
    so my question what is the best index type that i need to create on columns with non uniqueness values in the column.,
    Thank you In Advance,
    Milan

    There is nothing whatever wrong with creating an index on a VARCHAR column, or set of columns.
    Regarding the performance of VARCHAR/INT, as with everything in a RDBMS, it depends on what you are doing. What you may be thinking of is the fact that clustering a table on a VARCHAR key is (in SQL Server) marginally less efficient than clustering on a monotonically
    increasing numerical key, and can introduce fragmentation.
    Or you may be thinking of what you have heard about writing JOINs on VARCHAR columns - it is true, it is a little less efficient than a JOIN on numeric type, but it is only a little less efficient, nothing that would lead you to never join on varchar cols.
    None of this does not mean that you should not create indexes on VARCHAR columns. A needed index on a VARCHAR column will boost query performance, often by orders of magnitude. If you need an index on a VARCHAR, create it. It makes no sense to try to find an
    integer column to create the index on - the engine will never use it.
    Check this reference: http://stackoverflow.com/questions/14041481/is-it-good-to-create-a-nonclustered-index-on-a-column-of-type-varchar
    Mark ANSWER if this reply resolves your query, If helpful then VOTE HELPFUL
    INSQLSERVER.COM
    Mohammad Nizamuddin

  • What is the best data type for wallet application?

    Hi Friends..
    I want to know what is the best data type for wallet application..
    Assume that, i want to the Total of money saved digitally in Applet Wallet..
    And then if there's any transaction the Total of money which saved digitally in Applet Wallet would be Subtracted or Added depends on how much money that spent or saved..
    Which one is the best implementation of these scenarios :
    1. I save the User ID and Total of money in the Java Card, and then if there's any transactions, it would be added or subtracted directly and then saved again in the Java Card
    2. Or.. I save the User ID in the Java Card whereas Total of money in the Database, and then if there's any transactions, the ID would be read from the Card, and then select the Database based on that ID, and then Add or Subtract the money depends on how much money spent in the Transaction
    Please help me regarding this
    Thanks in advance

    Hi,
    Personally I would choose to store the total amount stored on the card. You could use two shorts (short[] perhaps) to store an integer (add more shorts to increase precision) and simply handle overflow your self. You could even look into using a third party library (or class) that treats a byte array as a big integer etc. There were some posts recently on floating point arithmetic that could be helpful for you since you will probably want to use decimals and JC does not natively support floats.
    Cheers,
    Shane

  • Bad index type for collection access ???

    Hi there,
    I am writing a script in VBA to connect to SAP.
    I encountered something strange.
    Why does this work:
    Set oSession = oConnection.Children(0)
    But this isn't:
    X = 0
    Set oSession = oConnection.Children(X)
    It results in an error: "Bad index type for collection access"
    Regards, Bas Prins

    Thanks,
    Although that is not proper VBA syntax I understand your suggestion.
    In VBA that would be:
    DIM X AS INTEGER
    X = 0
    Set oSession = oConnection.Children(X)
    But I tried several datatypes, all resulted in error.
    Regards, Bas.

  • Associative array type for each blob column in the table

    i am using the code in given link
    http://www.oracle.com/technology/oramag/oracle/07-jan/o17odp.html
    i chnages that code like this
    CREATE TABLE JOBS
    JOB_ID VARCHAR2(10 BYTE),
    JOB_TITLE VARCHAR2(35 BYTE),
    MIN_SALARY NUMBER(6),
    MAX_SALARY NUMBER(6),
    JOBPIC BLOB
    CREATE OR REPLACE PACKAGE associative_array
    AS
    -- define an associative array type for each column in the jobs table
    TYPE t_job_id IS TABLE OF jobs.job_id%TYPE
    INDEX BY PLS_INTEGER;
    TYPE t_job_title IS TABLE OF jobs.job_title%TYPE
    INDEX BY PLS_INTEGER;
    TYPE t_min_salary IS TABLE OF jobs.min_salary%TYPE
    INDEX BY PLS_INTEGER;
    TYPE t_max_salary IS TABLE OF jobs.max_salary%TYPE
    INDEX BY PLS_INTEGER;
    TYPE t_jobpic IS TABLE OF jobs.jobpic%TYPE
    INDEX BY PLS_INTEGER;
    -- define the procedure that will perform the array insert
    PROCEDURE array_insert (
    p_job_id IN t_job_id,
    p_job_title IN t_job_title,
    p_min_salary IN t_min_salary,
    p_max_salary IN t_max_salary,
    p_jobpic IN t_jobpic
    END associative_array;
    CREATE OR REPLACE package body SHC_OLD.associative_array as
    -- implement the procedure that will perform the array insert
    procedure array_insert (p_job_id in t_job_id,
    p_job_title in t_job_title,
    p_min_salary in t_min_salary,
    p_max_salary in t_max_salary,
    P_JOBPIC IN T_JOBPIC
    ) is
    begin
    forall i in p_job_id.first..p_job_id.last
    insert into jobs (job_id,
    job_title,
    min_salary,
    max_salary,
    JOBPIC
    values (p_job_id(i),
    p_job_title(i),
    p_min_salary(i),
    p_max_salary(i),
    P_JOBPIC(i)
    end array_insert;
    end associative_array;
    this procedure is called from .net. from .net sending blob is posiible or not.if yes how

    Ok, that won't work...you need to generate an image tag and provide the contents of the blob column as the src for the image tag.
    If you look at my blog entry -
    http://jes.blogs.shellprompt.net/2007/05/18/apex-delivering-pages-in-3-seconds-or-less/
    and download that Whitepaper that I talk about you will find an example of how to do what you want to do. Note the majority of that whitepaper is discussing other (quite advanced) topics, but there is a small part of it that shows how to display an image stored as a blob in a table.

  • Best Material Type for Handling Non-valuated Materials in Distribution

    Our distribution business will soon be handling non-valuated material and I am trying to determine the best material type to use.  I am considering material type UNBW but would like to know if anyone has advice.  We are strictly providing a service to the vendor for handling these non-valuated materials (for example, wood products).  We will not purchase or sell the product.  Our service consists of receiving the product into inventory from the vendor, tracking the inventory, (in Warehouse Management) and then shipping the material to a customer of the vendor's choosing.  For these non-valuating materials, we are paid strictly for our service of warehousing the material and shipping to a customer.
    Up until now, our distribution business has distributed only valuated materials, i.e., materials we purchase at a price and sell at a price.  We also use vendor consignment.  NOTE: This is not a vendor consignment scenario because we never buy the product.
    Here are our requirements:
    - We don't own the non-valuated product.
    - We need to be able to ship these new non-valuated products on the same shipments as the valuated product we own.
    - We use handling unit and warehouse management for all of our finished goods.
    - We would like to use our existing processes and HU/WM RF transactions to receive and pick the non-valuated product.  This means:
    1) Creating inbound deliveries and packing into HUs.  And applying our HU bar code labels.
    2) Physical inventory counts by HU.
    3) Creating sales orders that have both the non-valuated materials and valuated materials we own.
    4) Creating outbound deliveries and picking via transfer orders in WM.
    5) Assigning the outbound deliveries to a shipment.
    Questions:
    1)  Can a UNBW material that will be stocked but not valuated be received into inventory via a PO?  Any way to receive into inventory with an inbound delivery without using a PO?
    2)  Are there any problems with putting a non-valuated material on a sales order with a zero price?
    3)  Any challenges that other have run into?
    Thanks in advance.
    Rob

    I must be missing something regarding the use of material type UNBW.  When I post the goods receipt for a PO with a UNBW material, no inventory is created.  When I create the PO, an account assignment is required.  I tried both a cost center account assignment (K) and balance sheet account assignment (Z - using a Profit Center).  In both cases, I am forced to check the "Free item" checkbox to avoid entering a price; which also seems strange since the material is UNBW.
    I have searched everywhere for a "Best Practice" for my scenario with little results.  Again, we are simply managing the inventory for a vendor and shipping the inventory to our vendor's customers.  So we are acting as a third pary warehouse and shipper for the vendor.  We do not buy or sell the inventory - we are paid a monthly service fee by the vendor for warehousing their product and shipping it to their customers.  We may ship the product on sales order deliiveries that include both the "non-valuated" product (i.e., free goods we manage for this vendor) and goods that we actually own.
    As an alternative, I am wondering if I should look into somehow using vendor consignment with a settlement price (consignment info record price) of zero.  Vendor consignment is nice because you can track the stock by vendor.  However, we would never truly "settle" with the vendor because we would not be paying the vendor for the inventory and would never own it.
    Our business refers to this as "reload business" but I am not sure this is an industry standard term.
    Any other thoughts out there?

  • Iphoto photo import - best image type for max resolution (jpg vs tiff)

    What is the recommended image type for maximum resolution of photos brought into iphoto albums, since I will be enlarging them? (ie assuming everything brought into iphoto is set/reduced to a standard resolution, then jpg might allow more digital data for later enlargement; on the other hand tiff is often recommended for best resolution though it requires more space). Thanks, - D

    Thanks, Terence - OK, lets assume I shoot a 5-meg photo of a painting and adjust the paralax etc in photoshop so it is perfectly set inside the rectangular format. Now I want to import it into iphoto, knowing that I will use the crop tool to make two blow-up enlargements to go along with the original full-size image... total 3 related images of the artwork. As you mentioned these will eventually go into iweb as part of a series inside an album, with a hyperlink connecting the two enlargements to the full-size image... so viewers can tap to see finer detail and then go back to the overall composition. My question is, for the original photo image of the painting should I drag a 10-meg tiff into iphoto or a 2-meg jpg? (I do not know what importing the image into iphoto does to the original in terms of final image resolution and data size... Will a 2-meg jpg provide sufficient data to work with and enlarge via the cropping, or would the 10-meg tiff be better as a starting point? Or, if everything gets translated into a certain pre-ordained size anyway, would the tiff get watered down to, say, a 2-meg-size image anyway?) Thanks, - D

  • Predicate value Type for Created Date column

    Hi,
    What Predicate Type value should be passed on for the worklist column Created Date in IPredicate addClause method? I am passing GregorianCalendar type value but getting an exception. The return type from the WorklistColumns.CREATEDDATE is GregorianCalendar.
    Thanks,
    Mythili

    try java.sql.date

  • Using arrays as type for bind variable

    Hi all,
    I have this stored procedures that takes an array of strings as an argument:
    CREATE OR REPLACE PACKAGE mypackage AS
    TYPE StringArray IS VARRAY(100) OF VARCHAR2(16);
    PROCEDURE doSomething(v_strings IN StringArray);
    END;
    My java code looks something like:
    String[] strings = ...;
    CallableStatement cs = connection.prepareCall("CALL mypackage.doSomething(?)");
    cs.setObject(1, strings, java.sql.Types.ARRAY);
    calling the setObject method throws a SQLException: invalid column type.
    I have tried to change the call to:
    cs.setArray(1, new SqlStringArray(strings))
    where SqlStringArray is a wrapper around String[] that implements the java.sql.Array interface. This however throws a ClassCastException in oracle.jdbc.driver.OraclePreparedStatement. The latter is assuming it is receiving a class that implements yet another interface I guess.
    I also tried:
    cs.setObject(1, strings, java.sql.Types.VARCHAR);
    but that also throws a SqlException: invalid conversion requested
    Does anybody know how to bind String[] into a PreparedStatement?
    Any help is appreciated.
    Rudi.

    Made some progress. I am getting the OracleConnection from the WrappedConnection. This is a temporary solution for me so I would appreciate a final solution from anybody.
    I am now constructing a oracle.sql.ARRAY with an appropriate oracle.sql.ArrayDescriptor. I have found out that the type must be defined on a global level rather than in the scope of the package. Would be good if an Oracle expert could confirm that but I am happy to live with that.
    The IN parameter is correctly bound using the ARRAY instance but I am getting the following error when actually executing the statement:
    ORA-06512: Reference to uninitialized collection: at "BLUETEST_MYPACKAGE", line 57
    Now I have found quite some problem descriptions with that ORA error but all are dealing with OUT parameters that were not correctly initialized, i.e. the array constructor had not been called. In my case however, the array is initialized at by the java code and then bount to the sql statement. You would expect that the jdbc driver takes care of correctly initializing the PL/SQL collection wouldn't you.
    Does anybody know if I need to do anything extra?
    Many thanks,
    Rudi.

  • Best soundblaster solution for low latency recording/monitor

    hi, i have an emu 0404 that i use for my small desktop project studio, and i am happy as can be with it. i wanted to get a soundblaster to use for my laptop, and i've been looking at the audigy 2 nx, or the newer audigy 2 zs notebook. my question was, as both of these use asio drivers, is there any difference between them, performance-wise? does one have generally lower latency than the other? im not so concerned about the i/o on these cards so much as the latency. also, i would like to be able to use them for 5. surround mixing, which is the better bet for me? i specifically want a soundblaster and not an emu or some other higher-end usb interface because i want to use the soundblaster for gaming, music, movies, etc. so which should i get, the nx or the zs?
    thanks in advance
    mike

    El_Pepe,
    You will get the best performance from the Audigy 2 ZS Notebook. The PCMCIA connection has a lot more bandwidth than a standard USB 2.0 connection and allows for more features. The Audigy 2 NX is a great sound device, but if given the option I would select the notebook over the NX.
    Jeremy

  • What is the best field type for currency calculations?

    Hiya,
    I am doing a load of currency calculations e.g. here's one line of it
    The 'Total' fields I am using for doing/totalling my calculations has been defined as a local variable that reference an amount field setup in the data dictionary as:
    So in my program I am using these 2 decimal field.
    Of course I now realize this is a problem, as lots of rounding occurs and my values are way out when you deal with amounts in the millions.
    Does anyone know what type of variable they think is best for doing currency calculations?
    And could you provide a simple example?
    Many thanks!

    Hello Robert,
    I guess you can go ahead with ATFLV, incase if you want to display as a currency, you can use the function module  KKEK_CONVERT_FLOAT_TO_CURR.
    DATA: c_lv_float TYPE ATFLV VALUE '4.4500000000000000E+02',
          c_lv_curr TYPE WAERS VALUE 'EUR',
          c_lv_currval TYPE NETWR_AP.
    CALL FUNCTION 'KKEK_CONVERT_FLOAT_TO_CURR'
      EXPORTING
        float_imp          = c_lv_float
        curr_imp            = c_lv_curr
    IMPORTING
      CURR_FIELD_EXP      = c_lv_currval
    EXCEPTIONS
      OVERFLOW            = 1
      OTHERS              = 2.
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    WRITE:/ c_lv_currval.
    Output: 445,00
    Regards,
    TP

  • Best online game for low specs

    Hello everyone,
    I wonder what is the best online game one can play with an integrated intel chipset?
    I have tried quakelive which has a good community and it also run smoothly (~80 fps) on my computer. What else could you think of?
    Thanks a lot for your help !

    Oh my gosh I've been following this thread from it's creation and I still have NO IDEA what it's about.
    Are you talking about video games that are embedded in a web browser? Or, video games that connect to other plays via the Internet? What is "low specs"? Do emulated games count? How about games in an emulator that runs in a web browser? What genre do you want? How about THE COLLOSAL CAVE ADVENTURE? That can be played online and the system requirements are pretty much any toaster that runs NetBSD.
    Whatever. It doesn't matter. The answer to your question is "Tux Racer". In any thread about Linux gaming the answer is always Tux Racer.

  • Best export type for web viewing

    I just bought a Eyetv and recoreded me playing halo 2 on my 360. i was wondeirng what the best export for posting something on youtube would be. the choices i have are, quicktime movie, mpeg-4, h.264,divX avi, windows media, AAc audio and apple lossless audio. i was just wondering what the best is to post videos on youtube. i tried one but the quality didnt turn out so well once it was on youtube but before that it was clear. is it just youtubes uploads?

    i think it is just youtube decreasing the quality so it will stream quickly ... i always use quicktime movie though ... no particular reason for that though!

  • Best compression type for camcorder footage archiving?

    I have an increasing amount of "raw" digital camcorder data that's been downloaded onto my Mac, taking up increasingly large amounts of disk space. I'd like to archive much of this to DVD or an external hard drive, but may well want to edit it at a future date in FCP.
    My question is, what compression format should I use? I'm looking for something relatively "future-proof" in terms of likely developments, but will have as little visible loss as possible. I don't need ridiculously small files - a reduction of anything over 50% of the current 13BG per hour would be a start.
    I have Compression Master 4.1, which seems to offer an amazing amount of codecs, formats, rates, etc.

    If you captured all the footage (I assume DV) properly in FCP, in other words, with timecode. Then there is no real need to archive that footage. Just keep the original tapes and make sure to keep your FCP project file and any other non timecode material you may have used... music, graphics, titles etc.
    If you ever need to re-edit a project. Simply open the project and re-capture the footage.
    If you compress it to archive it's gonna look bad next time you use it and you will not be able to match it to any existing sequences.
    rh

  • Best File Type for Printing Ai Artwork

    Hi all,
    I have been designing in illustrator for a while, but am fairly new to designing media for print.  I am uploading a poster-size graphic to a web site that only accepts .jpeg and .png.  The graphic will be used on the web and will also be printed.  I know .png is preferable as it is not a lossy format and works better with vector art, but .png does not support CMYK color space for printing.  In a situation where I can only choose betweent the two, should I choose .jpeg over .png for better printing, despite the lossy format?
    Thanks for your help!

    I have to disagree. Only some digital printers prefer RGB files. Most want to get CMYK files. If you have text in clean black dreated a workflow with RGB involved will transform any clean black in clored 4c-black which has to be avoided.
    That's said it will exclude also PNG files. PNG  does not support CMYK and neither color management. So the printed outcome will not predictable.
    And if you send an Illustrator file for print use only PDF.
    AI would be fine, if the printer in not openen the file in Illustrator but only in Acrobat. If you have used fonts which are not available on the printers side or if you have linked files included into you AI file, opening an AI file will destroy that file. But if someone is using only a PDF or the PDF part of the AI file it is ok.
    EPS does not support transparency nor does it support color management. So it is to avoid also.
    JPG, PNG, TIFF and others are rasterizing the artwork and text by the image's resolution contrary to vector artwoork which will be rasterized on the devizes' resolution. This ends in a raggy edge of the vectors you really won't want.

Maybe you are looking for