| 9:34 pm on Jan 20, 2005 (gmt 0)|
I'm not sure about the first part...
But, you can do ORDER BY RAND() and it will sort randomly.
| 9:47 pm on Jan 20, 2005 (gmt 0)|
I would make your tinyint bigger, i do not believe mysql back fills the ones that are gone and I believe this should be the appropriate behaviour.
| 3:44 pm on Jan 21, 2005 (gmt 0)|
You are correct, jatar_k.
| 3:49 pm on Jan 21, 2005 (gmt 0)|
jatar_k and coopster
i always thought tinyint could only go as far as 256?
~ confused ~
| 3:56 pm on Jan 21, 2005 (gmt 0)|
255 they say...
| 3:59 pm on Jan 21, 2005 (gmt 0)|
so "I would make your tinyint bigger" means make it an int instead?
| 4:06 pm on Jan 21, 2005 (gmt 0)|
Yes. Or whatever size you determine is necessary.
| 4:17 pm on Jan 21, 2005 (gmt 0)|
i do not believe mysql back fills the ones that are gone and I believe this should be the appropriate behaviour.
thank god for that yes :)
| 4:42 pm on Jan 21, 2005 (gmt 0)|
hmmmm....Im sure there must be a way around this. What happens to tables/databases that regulary get updated changed etc. Such as rows being deleted and new ones inserted etc.
For instance I have a table with an auto_incrementing primary key as in my previous post. The table gets added to and rows deleted over a period of time. But MySQL inserts only up to ID number 255 as its data type is TINYINT, but the table has changed a lot and a lot of rows have been deleted so really the table only holds 20 records but it wont allow me to add any more as MySQL is trying to add record NO. 256. Ok change the data type you say, that will sort the problem out and yes it will.........but its ineficient. It consumes more disk space than is necessary. A TINY INT - 1 byte, a SMALLINT - 2 bytes. a MEDIUMINT - 3 bytes. an INT - 4 bytes and BIGINT - 8 bytes. So why use 8 bytes of space 4 will do?
But lets say I wasnt concerned about disk space. I changed the type to SMALLINT so I can now add more records. OK but over time it constantly changes with new records being added and deleted etc and It reachs its limit of (SMALLINT 65535). But in reality it holds no where near this number of rows but same scenario as before and I change data type. And on and on and on......until finally one day (few years on) It reaches the maximum amount it can hold BIGINT but I cant change type to add more rows so what then?
| 4:58 pm on Jan 21, 2005 (gmt 0)|
you could always export the table and import it again, empty keys will be empty and the fragmented table will have all rows at the beginning