If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > How long is this gonna take

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-12-11, 02:05
Backslider Backslider is offline
Banned
 
Join Date: Jun 2011
Posts: 40
How long is this gonna take

I have a two column table with a composite unique key. At some point another dev added another index to one of the columns, which of course is a waste of space.

In phpmyadmin I clicked to delete the extraneous index, but without first giving due thought to what I was doing.

The problem is that the table has over 38 million rows of data.....

How long this gonna take to complete?... already been a couple of hours
Reply With Quote
  #2 (permalink)  
Old 06-12-11, 05:42
mike_bike_kite mike_bike_kite is offline
vaguely human
 
Join Date: Jun 2007
Location: London
Posts: 2,519
Seeing as there are only 2 fields perhaps you could detail what they are and what the indexes were and how the data is normally accessed. Then we can say whether the indexes are useful or not.
__________________
Mike
Reply With Quote
  #3 (permalink)  
Old 06-12-11, 07:09
healdem healdem is offline
Jaded Developer
 
Join Date: Nov 2004
Location: out on a limb
Posts: 9,250
bit late for that, having already chopped one index

my guess would be that the PHP script or SQL has timed out and the exection has halted.
__________________
I'd rather be riding my Versys or my Tiger 800 let alone the Norton
Reply With Quote
  #4 (permalink)  
Old 06-12-11, 11:35
Backslider Backslider is offline
Banned
 
Join Date: Jun 2011
Posts: 40
The index was extraneous. Only the composite unique key was required.

Dropping the index took several hours due to the size of the table, however it saved over 700mb of space.

Always leary of phpmyadmin as it can be unpredicatable..... but this time it did what it should
Reply With Quote
  #5 (permalink)  
Old 06-12-11, 12:24
mike_bike_kite mike_bike_kite is offline
vaguely human
 
Join Date: Jun 2007
Location: London
Posts: 2,519
Quote:
Originally Posted by Backslider View Post
The index was extraneous.
So you said in your first post but I was simply trying to see whether you were correct in that assumption or whether other parts of the system are now likely to run slower.
__________________
Mike
Reply With Quote
  #6 (permalink)  
Old 06-12-11, 12:50
Backslider Backslider is offline
Banned
 
Join Date: Jun 2011
Posts: 40
The table is used for access control with userID plus a dataID for the data being accessed, so no, there is only a need for the composite key. Some may argue that dataID key is required for DELETE, but its not.

The disk space saving is significant.
Reply With Quote
  #7 (permalink)  
Old 06-12-11, 14:34
mike_bike_kite mike_bike_kite is offline
vaguely human
 
Join Date: Jun 2007
Location: London
Posts: 2,519
Quote:
Originally Posted by Backslider View Post
The table is used for access control with userID plus a dataID for the data being accessed, so no, there is only a need for the composite key. Some may argue that dataID key is required for DELETE, but its not.
Would anyone want to access the data using the dataID without a userID? say to find out which users have a given dataID. Do you feel the existing composit key would cover this?
__________________
Mike
Reply With Quote
  #8 (permalink)  
Old 06-12-11, 15:02
Backslider Backslider is offline
Banned
 
Join Date: Jun 2011
Posts: 40
No, it is never accessed in such a way, nor will ever be, but yes the existing key would suffice, because even though it is composite, one part can be used:

Code:
SELECT userID
FROM `access_master`
WHERE dataID = 62
LIMIT 0 , 30

// Showing rows 0 - 29 (2,917 total, Query took 0.0141 sec)
Clearly no table scan there

The concern, and reason for delete, was the amount of disk space required for the extraneous key. While watching my browser tick over waiting for that to complete, I became concerned since I am not familiar with how phpmyadmin goes about the task, plus knowing that it can fail with as simple a task as producing a dump from a large table. Thankfully it did not fail on this and corrupt the table.
Reply With Quote
  #9 (permalink)  
Old 06-12-11, 15:13
mike_bike_kite mike_bike_kite is offline
vaguely human
 
Join Date: Jun 2007
Location: London
Posts: 2,519
Oh well - if there's nothing to fix I'll leave it then.
__________________
Mike
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On