Jump to content

Working with large database tables


Asheeown

Recommended Posts

I think this is important, I did a show index query on the table.  It brought my Index up however UTCTime is first in the sequence.

[quote]
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
rated_cdrs 0 PRIMARY 1 ID A 2888305 NULL NULL   BTREE
rated_cdrs 1 IdTime 1 UTCTime A 2888305 NULL NULL YES BTREE
rated_cdrs 1 IdTime 2 Originating_TG A 2888305 NULL NULL YES BTREE


[/quote]
Link to comment
Share on other sites

effigy's off to a good start... BETWEEN is definitely more logic, and easier to read, and gives the parser/optimizer a hint that the same field needs to be examined for both inequalities.  However, if you're going to be sorting often, you should have a covering index on ( UTCTime, Originating_TG ), which will remove the filesort, and speed up your query.  You won't be able to ever use the lone index on the latter because you're using IN().
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.