Query to show the most useful Indexes in SQL?

So I'm familiar with the Queries that show the Bad Indexes, but, is there a query I can run that shows which Indexes are the best, or, most used?
This topic first appeared in the Spiceworks Community

Hi ganesh,
Thanks for response.
but assumption is wrong.
the values below 200 also needed and the values above 200(400,204) has to show 200 in the output of the report.
format before the output of the query.
james 400
kitty   200
jhones 180
francy  204.
Now my output has to show
james 200
kitty   200
jhones 180
francy  200.
I hope you can understand better now.
Thanks,
James

Similar Messages

  • Query to show the output using SUBSTR or REGEXP_SUBSTR

    Hi All,
    I need a help..
    I want to populate the data from varchar2 column, if it has the value 1,2,3 stored in it.
    Then I need to pick the values between the commas and show some string for each value available with commas.
    For Example: for '1' I should show India.
    For '2' I should show US.. etc.
    Regards
    Suresh

    According to me, your algorithm should be as follows:
    1) Create table dfntn which defines the relation between id and nm
    e.g
    id    nm
    1     India
    2     US
    3     Other2) Develop generic code which splits the data of any given values..
    e.g. 1,2,3 ...
    changed to
    id
    1
    2
    3
    .Now join this id with the dfntn. This way u will be maintaining more robust code.. i.e. even though your id assignment changes, u can control that in the table level itself.
    Cheers,
    Manik.

  • MDX Query to show the latest product text again historical facts (Type 2 dimenion linking on Surrogate key and also Natural Key)

    I need to write a MDX query to show the latest product text again historical facts or a chosen product text in time. I can write this query in TSQL, but new to MDX.
    The way I do it in TSQL is joining two queries together on the Natural Key as opposed to the surrogate key.
    Can this be done in MDX. I know I could write two separate MDX queries, one which get the product text I wan and the other to get the measure with the actual product text and Natural Key, and use a lookup function in ssrs to show the two result sets I the
    same tablix by looking up the Natural Keys. But this should be able to be done in one query shouldn't it.
    In the dsv the fact knows to join to the dimension using the surrogate key.
    Thanks J

    Hi Jamster,
    According to your description, you want to write a query to show the latest product text, right?
    In MDX, we can use LastNonEmpty function to return the lastest member winth a dimension. LastNonEmpty is an aggregation function available in the Enterprise version of SQL Server. However, you can create your own with a little bit of recursive MDX. Here
    is a sample query for you reference.
    With Member Measures.LastHits as
    iif(isempty(Measures.Hits),
    ([Date].[Year Month Day].prevmember,
    Measures.LastHits
    ),Measures.Hits)
    Reference
    http://cwebbbi.wordpress.com/2011/03/24/last-ever-non-empty-a-new-fast-mdx-approach/
    http://richardlees.blogspot.com/2010/07/getting-last-non-empty-value.html
    If this is not what you want, please provide us the detail structure of your cube and the expected result, so that we can make further analysis and give you the exactly MDX query.
    Regards,
    Charlie Liao
    TechNet Community Support

  • HT1414 I'm trying to restore from an earlier backup but my iphone only shows the most recent. I'm on Windows Vista and found the backup folder. If I delete the recent files, will it force the iPhone to backup from the next older file?  Why doesn't it show

    I'm trying to recover a file and the app company said to restore from an earlier backup.  My iPhone only shows the most recent backup.  I've been searching the net for answers - I found the back up file and date sorted them (over 6mb of files).  How can I get my iPhone to restore from an earlier backup? 
    I am on Windows Vista so I don't have Time Machine. 
    I have backed up the backup folder so if I mess it up, I have it in a separate place.
    Can I just delete all the files with todays date in that backup folder and have it forced to the next oldest date?
    Why doesn't the iPhone show a list of the least several backups.
    Info:
    iPhone 4S
    Software version  5.1.1
    Backed up to computer through iTunes (not iCloud)

    As you backup the iPhone in iTunes, it overwrites the last backup. Files are kept as they are changed, so that would explain how you get different dates in your backup folder. The only backups that are saved and not overwritten are the ones done just prior to a restore. You do have the option to go back in time on a Windows computer, however depending on the last time you set a restore point in Windows, it could be back further than you are willing to go.

  • Creation of a Query to show the values for the current month and the last 12 months data.

    Dear All,
    Good day!
    I have to create a Query with the below requirement.
    I have to create a Query to show the values for the current month and the last 12 months data.
    Can you please guide me how to achieve this ??
    thank you,
    Regards,
    Hema

    Hema
    explain the exact problem..? as you mentioned you want to create query to show values for current month and last 12 months.. so I think you want to show values for 12 months from current data.. you can achive this by multiple way..
    you can have selection screen and field with date .. and restrict based on system current date and 12 months before or you can handle this at your target.. .. I mean there are multiple ways to restrict data by date range..
    for some more hints..
    http://www.forumtopics.com/busobj/viewtopic.php?t=34393&sid=7fba465d0463bf7ff5ec46c128754ed6
    http://businessintelligence.ittoolbox.com/groups/technical-functional/cognos8-l/how-to-display-last-12-months-in-report-based-on-todays-date-3231850
    http://scn.sap.com/thread/3217381
    search on SDN you will get many other ways..
    Thanks,
    Bhupesh

  • What are the most useful/your favorite Ipod touch apps?

    I am currently in the market for an ipod and I'm just not sure if I need a touch or not. I would love a 16gig but they don't exist which means I have to spend a lot of money on 32 gig. Anyways, I am just curious if the investment will be worth it in the long run because of the app's. Yes, I realize that a useful app to you might not be to me and vice versa so I was just hoping you guys could list off some of the most useful ones for you guys personally so I can know what to expect. Thanks!
    Message was edited by: DreamAgainXI

    1. Apple's "Remote". I love the ability to control my computer (playing my iTunes library into my stereo) from anywhere in my house via wi-fi.
    2. "Units" (and others like it). Very handy tool to convert sq. feet to acres, meters per second to mph, N-m to ft-lb, etc.
    3. "Loan Shark" (and others like it). Very handy to figure out monthly payments on a loan given the interest rate/ term, calculating how much principle you will have paid after X months, etc.
    4. "Sports Tap". ¡Órale! Mexico just beat France 2-0!
    I have many others, but these I use a lot and find the most useful.

  • The most useful GPOs in Windows Server 2012R2

    What are in your opinion the most useful GPOs in Server 2012 R2 that improving the work of the administrator and raising level of network security.
    Cloud you share your opinion. please?
    This topic first appeared in the Spiceworks Community

    Good Morning All,I'm currently trying to run a script to convert all xls files to xlsxI am using a script written here:
    https://gist.github.com/gabceb/954418The script as is:PowershellAdd-Type -AssemblyName Microsoft.Office.Interop.Excel$xlFixedFormat = [Microsoft.Office.Interop.Excel.XlFileFormat]::xlOpenXMLWorkbookwrite-host $xlFixedFormat$excel = New-Object -ComObject excel.application$excel.visible = $false$folderpath = "C:\temp\test\test_1"$filetype ="*xls"Get-ChildItem -Path $folderpath -Include $filetype -recurse | ForEach-Object `{ $path = ($_.fullname).substring(0, ($_.FullName).lastindexOf(".")) "Converting $path" $workbook = $excel.workbooks.open($_.fullname) $path += ".xlsx" $workbook.saveas($path, $xlFixedFormat) $workbook.close() ## Create old folder and move original files here $oldFolder = $path.substring(0, $path....

  • Why does safari show the last used page when the Ipad is turned on again

    Why does Safari show the last used page when the IPad is next used?

    Read this article:  Open iOS Safari to a blank page, http://www.macworld.com/article/159303/2011/04/ios_safari_blank_page.html

  • Stickying some of the most-used topics

    Is there any way that we could sticky the most-used topics in this section? I use the Unity-for-Arch thread frequently, and I see other threads that are quite large. I see that the ATI thread was made sticky, for good reason. Can we do the same on the larger threads, such as Unity-for-Arch, KF 5 and Plasma, i3, Pantheon Shell, etc.?

    horsemanoffaith wrote:Is there any way that we could sticky the most-used topics in this section? I use the Unity-for-Arch thread frequently, and I see other threads that are quite large. I see that the ATI thread was made sticky, for good reason. Can we do the same on the larger threads, such as Unity-for-Arch, KF 5 and Plasma, i3, Pantheon Shell, etc.?
    You should just use KSE (karol search engine) instead

  • The most used transactions

    Hi guys , I need to update the most useful costumer transaction  , is there a way to list the  Z transactions and programs that  I use the most in a specific date (Or range) ?? thank you for your help .

    Hi!
    I have more or less the same need as you, I would need to get a list of when was execute some transactions, to be able to decide if there are obsolate or not... Do you have any idea how could I get this information?
    I tried with STAT, but it seems is to much information and I get a timeout....
    Thank you and kind Regards,
    Carolina.

  • HT6439 This is probably the most useful article I have seen here. Would anyone else agree?

    This is probably the most useful article I have seen here. Would anyone else agree? 10/10

    No. I enjoyed the album.

  • Query takes 5 min when using Indexes and 1 Second without Indexes !!

    Hi,
    We have been using indexes on all tables until recently when we faced problems with queries like the one below:
    SELECT a.std_id FROM students a, student_degree b, student_course c, course d
    WHERE b.std_id = a.std_id
    AND c.std_id = a.std_id
    AND d.crn = c.crn
    AND b.in_progress = 'Y'
    AND b.major_code = 'ABTC'
    AND a.program_code = 'DP'
    AND a.level_code = 'S2'
    AND a.campus_code = '05'
    AND a.termcode = '200702';
    This query takes more than 5 minutes to return a result, but as soon as we remove indexes on the columns termcode and campus_code,it shows result in 1 second.
    What could be the problem ?, Is there an attribute that need to be set when creating these indexes ?
    Thanks in advance
    Madani

    Thank you Karthik for your reply.Here are the explain plan report (as shown on Oracle 9i Enterprise Manager)
    *1-Explain plan without Indexes:*
    Execution Steps:
    Step # Step Name
    11 SELECT STATEMENT
    10 MERGE JOIN
    7 SORT [JOIN]
    6 NESTED LOOPS
    4 NESTED LOOPS
    1 ERMS.STUDENT_DEGREE TABLE ACCESS [FULL]
    3 ERMS.STUDENTS TABLE ACCESS [BY INDEX ROWID]
    2 ERMS.SYS_C006642 INDEX [UNIQUE SCAN]
    5 ERMS.SYS_C007065 INDEX [RANGE SCAN]
    9 SORT [JOIN]
    8 ERMS.COURSE TABLE ACCESS [FULL]
    Step # Description
    1 This plan step retrieves all rows from table STUDENT_DEGREE.
    2 This plan step retrieves a single ROWID from the B*-tree index SYS_C006642.
    3 This plan step retrieves rows from table STUDENTS through ROWID(s) returned by an index.
    4 This plan step joins two sets of rows by iterating over the driving, or outer, row set (the first child of the join) and, for each row, carrying out the steps of the inner row set (the second child). Corresponding pairs of rows are tested against the join condition specified in the query's WHERE clause.
    5 This plan step retrieves one or more ROWIDs in ascending order by scanning the B*-tree index SYS_C007065.
    6 This plan step joins two sets of rows by iterating over the driving, or outer, row set (the first child of the join) and, for each row, carrying out the steps of the inner row set (the second child). Corresponding pairs of rows are tested against the join condition specified in the query's WHERE clause.
    7 This plan step accepts a row set (its only child) and sorts it in preparation for a merge-join operation.
    8 This plan step retrieves all rows from table COURSE.
    9 This plan step accepts a row set (its only child) and sorts it in preparation for a merge-join operation.
    10 This plan step accepts two sets of rows sorted on the join key. By walking both sets of rows in the order of the join key, every distinct pair of rows satisfying the join condition in the WHERE clause is found through a single pass of the row sets.
    11 This plan step designates this statement as a SELECT statement.
    *2-Explain plan with Indexes:* (I added index on column campus_code which is a varchar2 column)
    Execution Steps:
    Step # Step Name
    11 SELECT STATEMENT
    10 MERGE JOIN
    7 SORT [JOIN]
    6 NESTED LOOPS
    4 NESTED LOOPS
    1 ERMS.COURSE TABLE ACCESS [FULL]
    3 ERMS.STUDENTS TABLE ACCESS [BY INDEX ROWID]
    2 ERMS.INDEX_STUDENTS_CAMPUS_CODE INDEX [RANGE SCAN]
    5 ERMS.SYS_C007065 INDEX [RANGE SCAN]
    9 SORT [JOIN]
    8 ERMS.STUDENT_DEGREE TABLE ACCESS [FULL]
    Step # Description
    1 This plan step retrieves all rows from table COURSE.
    2 This plan step retrieves one or more ROWIDs in ascending order by scanning the B*-tree index INDEX_STUDENTS_CAMPUS_CODE.
    3 This plan step retrieves rows from table STUDENTS through ROWID(s) returned by an index.
    4 This plan step joins two sets of rows by iterating over the driving, or outer, row set (the first child of the join) and, for each row, carrying out the steps of the inner row set (the second child). Corresponding pairs of rows are tested against the join condition specified in the query's WHERE clause.
    5 This plan step retrieves one or more ROWIDs in ascending order by scanning the B*-tree index SYS_C007065.
    6 This plan step joins two sets of rows by iterating over the driving, or outer, row set (the first child of the join) and, for each row, carrying out the steps of the inner row set (the second child). Corresponding pairs of rows are tested against the join condition specified in the query's WHERE clause.
    7 This plan step accepts a row set (its only child) and sorts it in preparation for a merge-join operation.
    8 This plan step retrieves all rows from table STUDENT_DEGREE.
    9 This plan step accepts a row set (its only child) and sorts it in preparation for a merge-join operation.
    10 This plan step accepts two sets of rows sorted on the join key. By walking both sets of rows in the order of the join key, every distinct pair of rows satisfying the join condition in the WHERE clause is found through a single pass of the row sets.
    11 This plan step designates this statement as a SELECT statement.

  • How do I get the location bar drop-down list to show the most recently visited page at the top? I have no idea how it's deciding what to display.

    In IE when you show the drop-down list from the location bar, it show you all of your most recently visited pages in descending order with the most recent at the top. Firefox is showing me a list that I have no idea where it's getting the pages from or how it's ordering them. It doesn't update the pages or the order when I go to a new page. I have recently switched from IE to Firefox and cannot figure out how to get Firefox to do this; very annoying.

    That drop down list doesn't show recently visited pages, but shows list list of most visited sites sorted by what the Mozilla devs call frecency (frequency and recency) and is based on bonus points. It is not possible to have much influence on what shows on that list.
    If you want a list of recently visited sites then you can use a smart bookmark e.g. on the Bookmarks Toolbar with the location set to this smart folder.<br />
    Name: <b>Recently Visited</b><br />
    Location: <b>place:queryType=0&sort=4&maxResults=30</b><br />
    You need to close and restart Firefox to make that folder work as intended.
    * https://support.mozilla.org/kb/Smart+Bookmarks+folders
    See also:
    * http://developer.mozilla.org/en/The_Places_frecency_algorithm
    * http://kb.mozillazine.org/places.frecency.numVisits

  • Shopping cart creation category dropdown selecting the most used category

    Hi SRM gurus,
    While creating a shopping cart one of our most used category gets selected by default before we start doing anything.
    Everytime we have to change the category.
    Is there a way that will become blank and we can select from the dropdown or the find list.
    Kindly suggest.
    We are using SRM component version 4.0, SRM server 5.0, our patch level 0008.
    Thx. & reg.,
    Sridhar.

    Hi
    <b>Yes.. This was happening with us when we used SRM 4.0 version.
    We have used an  BADI Implementation to resolve this issue.</b>
    <u>The BADI name is <b> BBP_F4_READ_ON_EXIT </b></u>
    For Product category -> Product category (attr. WGR, PRCAT)  GET_CATEGORY Method, you need to go ahead.
    <u>Read the documenation of this BADI and you will get the problem resolved after implementing the same.</u>
    Here is the documentation
    BBP_F4_READ_ON_EXIT
    Short Text
    Restrict the Display in Input Helps and Search Helps
    You can use the Business Add-In (BAdI) BBP_F4_READ_ON_EXIT to restrict (or augment) the list of values and favorites that are output in the input and search helps. You can only process data elements for which input helps exist on HTML templates. The following three BAdIs are also available:
    BBP_F4_READ_ON_ENTRY
    Use this BAdI if you do not just want to restrict the favorites and values list but also want to select this yourself.
    BBP_F4_MEM_UPDATE
    BBP_F4_SAVE_DB
    The following three modules are used to process the values per data element:
    BBP_GET_<data element>_F4
    Supplies a list of all values and user-specific favorites. You can influence how this module works using BAdI BBP_F4_READ_ON_ENTRY and BBP_F4_READ_ON_EXIT.
    BBP_UPD_<data element>_FAV
    Updates the favorites in internal function group storage. You can influence how this module works using BAdI BBP_F4_MEM_UPDATE.
    BBP_SET_<data element>_FAV
    Writes the current favorites to the database. You can influence how this module behaves using BAdI BBP_F4_SAV_DB.
    Use
    Only implement this BAdI and only program the appropriate method if you want to restrict or augment the value set of standard selection.
    If you determine favorites using a BAdI, the standard modules do not process the favorites further. Warning: If, deviating from standard selection, you determine the list of favorites yourself using a BAdI, you have to temporarily store the favorites in the methods of the BAdIs and carry out final saving to the database yourself.
    Standard settings
    If data is added via the methods, no check of this data occurs. The check has to occur in the methods themselves.
    The interfaces of the methods of the BAdI are (almost) always the same:
    IV_LANGUAGE
    Language for determination of the texts
    IV_USER
    User for which the values are requested
    ET_<data element>_LIST
    The list of valid values changed by you
    EV_X_FAV_PROCESSED
    Use "X" to stipulate that you have filled the favorites list. Only present if favorites table exists for relevant data element.
    ET_<data element>_FAVOURITES
    Changed favorites list for user IV_USER. Only exists if favorites table exists for relevant data element.
    The methods have to fill the structures of the transfer tables completely. Incompletely filled structures can cause followup errors and unforseen consequences.
    Activities
    Reading of value lists and favorites using function module BBP_GET_<data element>_F4 occurs as follows:
    1. First the BAdI BBP_F4_READ_ON_ENTRY is called. It is possible to fill the input list (and favorites) with default values.
    a) In the case of default values, exactly these values are returned to the initiator. No further processing or check occurs and the module is exited.
    b) If no default values exist, the standard selection is carried out.
    2. Before the values are transferred externally you can restrict or augment the number of hits using the BAdI BBP_F4_READ_ON_EXIT. You can therefore delete entries from or add entries to the input list or favorites list.
    3. BAdI BBP_F4_READ_ON_EXIT provides an individual method for each data element for which an input help and/or favorites table exists. These are listed below.
    If you use this method, you need to indicate processing using the parameter EV_X_LIST_PROCESSED or EV_X_FAV_PROCESSED. Otherwise the selection is lost.
    List of available methods per data element in BBP_F4_READ_ON_EXIT:
    Field/Data element  Method
    Currency    GET_CURRENCY
    Region    GET_REGION
    Country    GET_COUNTRY
    Language    GET_LANGUAGE
    Industry     GET_INDUSTRY
    Academic title    GET_ACADEMIC
    Time zones    GET_TIMEZONE
    Procurement cards   GET_PCARD
    Legal forms     GET_LEGAL
    Format for name format    GET_NAMEFORM
    Quality management systems    GET_QMSYSTEM
    Fixed values    GET_DOMVALUE
    Form of address texts    GET_TITLEKEY
    Units of measure   GET_UNIT
    Bank data    GET_BANKINFO
    Tax number types   GET_TAXNUMT
    Tax numbers per country    GET_TAXTYPE
    Tax groups per tax type    GET_TAXGROUP
    Terms of payment    GET_PAYMTERM
    RFC destinations   GET_RFC_LOGS
    Logical systems   GET_LOGSYS
    Tax codes     GET_TAXCODE
    Catalogs (attribute CAT)   GET_CATALOG
    Roles (attribute ROLE)   GET_ROLE
    Account assignment categories (attribute KNT) GET_KNT_ATTR
    Purchasing organizations (from PdOrg)  GET_PURCHORG
    Purchasing organizations (per company)   GET_PORGCOMP
    Purchasing group (from PdOrg)  GET_PURCHGRP
    Purchasing group (per company)  GET_PGRPCOMP
    Product category (attr. WGR, PRCAT)  GET_CATEGORY
    Products    GET_PRODUCT
    Goods recipient plant (attr. REQUESTER)  GET_GRCPLANT
    Goods recipient user (attr. REQUESTER)  GET_GRCUSER
    Requester (attribute REQUESTER)  GET_BOBUSER
    Cost centers (attribute CNT)   GET_COSTCENT
    Asset classes (attribute ANK)   GET_ASSETCL
    Assets (attribute AN1)   GET_ASSETNO
    Asset subnumbers (attribute AN2)  ET_ASSETSUB
    Network (attribute NET)   GET_NETWORK
    WBS element (attribute PRO)  GET_WBSELEM
    Order (attribute ANR)   GET_ORDERNO
    Customer order (attribute AUN)  GET_SDDOC
    Customer order item (attribute APO)  GET_SDDOCPOS
    Document type (attribute BSA)  GET_DOCTYPE
    Transaction type (attribute TEND_TYPE)  GET_TENDTYPE
    <i>Incase you face any problems, do let me know.</i>
    Hope this will help.
    Please reward suitable points.
    Regards
    - Atul

  • Query result shows the same data twice

    Hello All,
    I've created UDFs like Supplier Name, Supplier Address, and (Excise Details like)Supplier ECC No,
    Supplier Range.
    And I've created Query for Supplier Name and Supplier Address, and I assigned to FMS, Its working Correctly.
    I've created Query for Supplier ECC No. the Query is,
    SELECT  T0.[ECCNo],T1.[CardName]
    FROM CRD7 T0  INNER JOIN OCRD T1 ON T0.CardCode = T1.CardCode
    WHERE T0.[ECCNo]  Like  '[%]'
    I saved the Query, and assigned to FMS.
    At this stage (i.e. Query for Supplier ECC No.) the above Query showing the same data twice.
    Please suggest to rectify the problem.
    Thanks,
    Pratheeviraj

    You can get rid of the duplicates by changing the query to
    SELECT DISTINCT T0.ECCNo,T1.CardName
    FROM CRD7 T0 INNER JOIN OCRD T1 ON T0.CardCode = T1.CardCode
    WHERE T0.ECCNo Like '[%]'
    But it is always worth understanding why you are getting multiple records to check that you are getting back what you want.  I think you may be seeing this because CRD7 can have multiple records for a business partner - maybe one for each of 'pay-to' and 'ship-to' address?

Maybe you are looking for

  • Create trasport reqeusts directly in quality system

    Hello All, We have a three system landscape TMS configuration (DEVL-QUAL-PROD) and QUAL is defined as consolidated system. Because of lot of developers doing/testing changes to configuration on DEVL, we made some changes directly in QUAL intend to im

  • IMac or Macbook Pro for Cubase?

    I write music in Cubase Elements 6 (similar to Apple's DAW Logic Pro X) and i use lots of MIDI VSTs and virtual instruments.  The iMac I have now is a 2007 Core 2 Duo with 4gb RAM and it can't handle my songs once I put more than 5 tracks down.  I wa

  • Email icon unread count - one account only

    On ios7 I have two email accounts, yahoo and work, I want the mail icon to show unread only for my work like it used to.  It doesn't matter which mailbox I filter to the icon always show all unread, how can this be changed?

  • Biztalk service account permissions

    I  am trying to configure BizTalk server 2010 using service account. I have added my service account as administrator group. My service accont doesn't have login rights. when i am trying to run configuration usnder server account(shift+Rightclick con

  • Save image to local folder

    Hi, I am using Labview to out put the images from a external camera. There is a 32bit 2D array output integer. How can I save the image to local folder. I have used following functions. Even though the program runs just fine, there is no image saved