Jump to content

Simple q: Confusion about exact datatype meaning


NoUser2U

Recommended Posts

Let's say i have a table:CREATE TABLE users (id INT UNSIGNED AUTO_INCREMENT)Due to the UNSIGNED option of the INT-datatype, the range of INT is 0 - 4294967295 (source: mysql manual).Now what i am confused about is, is that range the total number of rows the users-table can hold, or is '4294967295' the highest value the 'integer' column can hold?For example, will my users-table 'run out of space' when the table contains exactly 4294967295 rows? like so:-----id (this table contains 4294967295 rows)-----0123....4294967295-----Or will it 'run out' when there is a HUGE gap between 0 and 4294967295, like:-----id (this table contains 5 rows)-----01234294967295-----I'm sure this is a very simple question, but i've been looking the internet for a long time but found no question to this simple thing unfortunately :).Much thank in advance!

Link to comment
Share on other sites

It is the highest value that can be stored in one cell in that column. The data type has no relationship to the number of rows. It is a kind of "instruction" that optimizes the database.

Link to comment
Share on other sites

Ooh i get it, thank you very much.So in theory, the number of rows a table may contain is infinite? For example:CREATE TABLE users (firstname CHAR(5))Since this table has no columns consisting of any numeric datatypes, it may practically contain unlimited rows?

Link to comment
Share on other sites

Ooh i get it, thank you very much.So in theory, the number of rows a table may contain is infinite? For example:CREATE TABLE users (firstname CHAR(5))Since this table has no columns consisting of any numeric datatypes, it may practically contain unlimited rows?
your table can expand as far it can grow. if you need more range in usrid column you can make it bigint
Link to comment
Share on other sites

Tables can theoretically contain indefinite numbers of rows, however practically there are multiple engine, storage format and other limitations. For example, since MyISAM (a popular storage scheme for tables in MySQL) uses 32-bit pointers for the row locations, you can only store 4GB of data (sort of) before the table is "full".

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...