LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-16-2010, 09:31 AM   #1
anaigini45
Member
 
Registered: Nov 2009
Posts: 49

Rep: Reputation: 15
Database tuning


I have databases with sql queries that use variables int. They also use varchar as attributes.

According to a tutorial that I've read, some of the ways to improve the DBMS performance is to use the suggestions :

-Use small variants such as SMALL INT or MEDIUM INT instead of the regular choice INT
-Use fixed-length attributes, that is try to avoid types such as VARCHAR/BLOB.

So does this mean that I have to change all the original variables in the sql file or is just appropriate to change attributes in the my.cnf to fine tune the performance of the mysql database?
 
Old 01-16-2010, 10:57 AM   #2
indienick
Senior Member
 
Registered: Dec 2005
Location: London, ON, Canada
Distribution: Arch, Ubuntu, Slackware, OpenBSD, FreeBSD
Posts: 1,853

Rep: Reputation: 65
I wouldn't worry about it too much, unless you are noticing serious database lag on simple queries. Whenever it comes to integer fields, I just use INT (with the default length of 11). As for text fields, in MySQL, I use the TEXT type - not VARCHAR; basically, this boils down to laziness on my part. However, I would use VARCHAR in cases where I know the data in that field must be a specific size (ie. phone numbers, alphanumeric employee IDs, etc.).

Really, in my thinking, it would seem as though should you want to maintain peppiness in your SQL queries, balance the load between your database and your front-end (whatever it may be). For example, at work, we have one server where its sole purpose is to be a MySQL server, and we have a second server which is solely for Apache - if it comes to an area of any of my programs where there is always a possibility of a MASSIVE query being made to the server, I do rough query matching on the MySQL side, and then fine-tune the results in PHP on the Apache server.

One of my co-workers does not agree with my "brutish load balancing technique" but I am not the one always having to make excuses as to why my PHP programs run so slowly on seemingly "simple" tasks.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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



Similar Threads
Thread Thread Starter Forum Replies Last Post
DBI Connect Failed:Access denied for user ''@'localhost' to database <database> error kaplan71 Linux - Software 3 06-05-2009 12:39 PM
How can i copt the MYSQL Database to a other server (Database) halvorls Linux - Server 3 07-27-2008 09:19 PM
(my)sql: drop database doesn't remove database kpachopoulos Programming 3 09-19-2007 01:32 PM
Database Programming (database to database transaction) johncsl82 Programming 7 02-02-2007 08:20 AM
LXer: A database solution is more than database software LXer Syndicated Linux News 0 09-25-2006 08:54 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:21 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration