Using Composite Indexing

Ask a Question related to Coldfusion Database Access, Design and Development.

  1. #1

    Default Using Composite Indexing

    I am using a simple query against a MySQL table with a selection based upon two
    columns.

    SELECT *
    FROM clog
    WHERE cfid = '#client.cfid#' AND cftoken = '#client.cftoken#'

    Used together cfid and cftoken are unique so...

    Considering performance, am I better off indexing both cfid and cftoken and
    leaving my WHERE clause as it is above or should I create a composite index?

    If I create a composite index will MySQL automaticlly use it if I use the
    WHERE clause above or do I need to change the WHERE clause, if so how?

    drmaves Guest

  2. Similar Questions and Discussions

    1. Losing Composite Control property that another Composite Control ...
      Hi, I'm creating 2 composite controls in ASP.net. Control 1 is a Search control and control 2 is a Map control. I have added a property...
    2. Indexing
      I searched this forum but couldn't find an answer. I've indexed a 60 page book and now need to make some corrections. How do I open the index palette...
    3. Possible to create a composite control that has a child control that is a validator that validates the composite control itself?
      I am attempting to create a composite control which has a label, followed by an optional error message, followed by two text boxes. I have...
    4. `Indexing`in CS
      What is it and is it important: Mac OX 10.3.3, G5 dual processor. First time I`ve used this forum so thanks to anyone that can help. Richard.
    5. Indexing PDF's using MS Indexing Service
      Hi, I currently use MS Indexing Service to search my htm and aspx pages. I recently downloaded the IFilter tool from Adobe. When I now do a...
  3. #2

    Default Re: Using Composite Indexing

    > I am using a simple query against a MySQL table with a selection based
    upon two
    > columns.
    >
    > SELECT *
    > FROM clog
    > WHERE cfid = '#client.cfid#' AND cftoken = '#client.cftoken#'
    >
    > Used together cfid and cftoken are unique so...
    >
    > Considering performance, am I better off indexing both cfid and cftoken
    and
    > leaving my WHERE clause as it is above or should I create a composite
    index?

    I think in this case it's better to create a composite index on cfid and
    cftoken.
    > If I create a composite index will MySQL automaticlly use it if I use the
    > WHERE clause above or do I need to change the WHERE clause, if so how?
    I'm pretty sure you don't need to change the where clause. You can use
    explain to see what index will be used:

    EXPLAIN
    SELECT *
    FROM clog
    WHERE cfid = '#client.cfid#' AND cftoken = '#client.cftoken#'

    --
    <mack />


    Neculai Macarie Guest

  4. #3

    Default Re: Using Composite Indexing

    Using EXPLAIN helped a lot. I had an index on cfid, cftoken and a composite
    index on cfid and cftoken. Keeping the WHERE clause the same, EXPLAIN showed
    that MySQL used the composite index. Now I can delete the first two indexes and
    maintain only the composite index.

    drmaves Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139