fenway Posted February 8, 2008 Share Posted February 8, 2008 It will only be used if you use the N leftmost keys in a query. If you have (key1, key2, key3), and you try and search for key2 = something, it won't use it. Again, if you're using all three (or N left) parts regularly, it may improve performance. And it's the same size as 3 separate keys. Quote Link to comment Share on other sites More sharing options...
jaymc Posted February 8, 2008 Author Share Posted February 8, 2008 You said if I try search for key 2 it wont use it... Well, does that mean in essance key 2 has no index at all With that said, is the normal method to create an additional index for each key as backup? Quote Link to comment Share on other sites More sharing options...
fenway Posted February 8, 2008 Share Posted February 8, 2008 That's right... again, covering indexes are for optimization problems... if you're going to be searching by key2 a lot without key1, then yes, have both. You may also want to read up on the way index_merge works in 5.0. Quote Link to comment Share on other sites More sharing options...
jaymc Posted February 9, 2008 Author Share Posted February 9, 2008 IS there much overhead on having a covering index? Quote Link to comment Share on other sites More sharing options...
fenway Posted February 9, 2008 Share Posted February 9, 2008 Just like any other index, it has to be updated, takes up space, etc. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.