MySQL Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesMySQL Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
  #1  
Old May 1st, 2008, 10:53 AM
onassar onassar is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2004
Location: Waterloo, Ontario, Canada
Posts: 412 onassar Negative: is most likely a SPAMMER and a traitor to the cause. 
Time spent in forums: 2 Days 3 h 9 m 30 sec
Reputation Power: 0
Send a message via ICQ to onassar Send a message via MSN to onassar
Mysql optimization questions

Hey guys,

I search through mysql forums but couldn't find a concise place for this topic.

I have a generic table storing a user_ID and some true/false values like 'is_logged_in' etc.

I've discovered that the best way, storage wise, to store those true/false values is through a tinyint(1) with values of 0/1 marking false/true.

I'm wondering what would probably make sense for unique auto incrementing user_ID's. Assume that it may need to get into the millions of users. Any thoughts? Right now I've got it set to int(10) unsigned.

Thanks.
__________________
Florida Vacations

Reply With Quote
  #2  
Old May 1st, 2008, 12:09 PM
ccalender ccalender is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2006
Posts: 166 ccalender User rank is Corporal (100 - 500 Reputation Level)ccalender User rank is Corporal (100 - 500 Reputation Level)ccalender User rank is Corporal (100 - 500 Reputation Level)ccalender User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 1 Day 21 h 56 m 51 sec
Reputation Power: 6
Quote:
Originally Posted by onassar
I'm wondering what would probably make sense for unique auto incrementing user_ID's. Assume that it may need to get into the millions of users. Any thoughts? Right now I've got it set to int(10) unsigned.


I think an INT is fine. Note that the (10) is a display width, so it will not affect the actual size. An INT will take 4 bytes.

INT unsigned allows for over 4 billion rows (or effectively users). You could possibly even get by with using MEDIUMINT UNSIGNED, as it will accomodate 16,777,215 values (if unsigned). MEDIUMINT inly uses 3 bytes, so maybe that's an option for you.

For more details on the above, please see the following page:

http://dev.mysql.com/doc/refman/5.0/en/numeric-types.html

Reply With Quote
  #3  
Old May 2nd, 2008, 02:44 PM
onassar onassar is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2004
Location: Waterloo, Ontario, Canada
Posts: 412 onassar Negative: is most likely a SPAMMER and a traitor to the cause. 
Time spent in forums: 2 Days 3 h 9 m 30 sec
Reputation Power: 0
Send a message via ICQ to onassar Send a message via MSN to onassar
quick question. i'm debating how i should be treating my booleans.

right now, as mentioned I've got a tinyint(1) set up for 1/0 vaues. but i keep reading that int's in general shouldn't be used unless you expect to be using some sort of calculations with them, which im not since they just represent boolean states.

any ideas? i'm thinking enum('true','false') in order for consistancy and readability. more than anything though, i'd like to follow a standard here so that it makes sense to myself and others in the future.

thanks.

Reply With Quote
  #4  
Old May 2nd, 2008, 09:40 PM
r937's Avatar
r937 r937 is offline
SQL Consultant
Dev Shed God 24th Plane (16500 - 16999 posts)
 
Join Date: Feb 2003
Location: Toronto Canada
Posts: 16,727 r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level)r937 User rank is Lieutenant General (80000 - 90000 Reputation Level) 
Time spent in forums: 1 Month 3 Weeks 2 Days 19 h 22 m 42 sec
Reputation Power: 848
ENUM is the spawn of the devil

stick to TINYINT for your boolean columns
__________________
r937.com | rudy.ca

Reply With Quote
  #5  
Old May 3rd, 2008, 06:58 PM
onassar onassar is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2004
Location: Waterloo, Ontario, Canada
Posts: 412 onassar Negative: is most likely a SPAMMER and a traitor to the cause. 
Time spent in forums: 2 Days 3 h 9 m 30 sec
Reputation Power: 0
Send a message via ICQ to onassar Send a message via MSN to onassar
sweet, thanks man.

Reply With Quote
  #6  
Old May 3rd, 2008, 07:08 PM
lnxgeek lnxgeek is offline
I AM A GOLDEN GOD
Dev Shed God (5000 - 5499 posts)
 
Join Date: Apr 2003
Location: cannot find symbol: method showLocation()
Posts: 5,278 lnxgeek User rank is Colonel (50000 - 60000 Reputation Level)lnxgeek User rank is Colonel (50000 - 60000 Reputation Level)lnxgeek User rank is Colonel (50000 - 60000 Reputation Level)lnxgeek User rank is Colonel (50000 - 60000 Reputation Level)lnxgeek User rank is Colonel (50000 - 60000 Reputation Level)lnxgeek User rank is Colonel (50000 - 60000 Reputation Level)lnxgeek User rank is Colonel (50000 - 60000 Reputation Level)lnxgeek User rank is Colonel (50000 - 60000 Reputation Level)lnxgeek User rank is Colonel (50000 - 60000 Reputation Level)lnxgeek User rank is Colonel (50000 - 60000 Reputation Level)lnxgeek User rank is Colonel (50000 - 60000 Reputation Level)lnxgeek User rank is Colonel (50000 - 60000 Reputation Level) 
Time spent in forums: 1 Month 1 Day 21 h 17 m 36 sec
Reputation Power: 564
Quote:
Originally Posted by r937
ENUM is the spawn of the devil

stick to TINYINT for your boolean columns


Exactly. Notice if you actually specify BOOL for a column it's TINYINT(1).
__________________
BookMooch.com : Give books away. Get books you want.

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesMySQL Help > Mysql optimization questions


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

 Free IT White Papers!
 
Accelerating Trading Partner Performance
One in five. That's how many partner transactions have at least one error. That is an amazing statistic, particularly given the extraordinary leaps in innovation across the global supply chain during the past two decades. Download this white paper to learn more.

 
Competing on Analytics
This Tech Analysis is designed to help identify characteristics shared by analytics competitors, and includes information about 32 organizations that have made a commitment to quantitative, fact-based analysis.

 
Cost Effective Scaling with Virtualization and Coyote Point Systems
An overview of the industry trend toward virtualization, how server consolidation has increased the importance of application uptime and the steps being taken to integrate load balancing technology with virtualized servers.

 
Five Checkpoints to Implementing IP Telephony
Implementation planning for IP PBX software and IP telephony has become vital as businesses replace discontinued legacy PBX phone systems. This informative whitepaper outlines five "checkpoints" for any implementation plan that will help make IP communications a successful proposition.

 
Hosted Email Security: Staying Ahead of New Threats
In the last two years, email has become a fierce battleground between the nefarious forces of spam and malware, and the heroes of messaging protection. The spam volumes increased alarmingly every month, bringing clever new forms of phishing and virus propagation attacks.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway