473,761 Members | 6,993 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Major diff between varchar of 70 against varchar of 100?

Hi All

One of my VarChar fields in my MySQL DB isn't big enough so I need to expand
it. In light of this, could you please answer these queries:

1) How do I expand the size of the field without affecting the actual data
inside the field?

2) As I like to try and keep things as tight as possible in the DB, is there
any REAL differences between changing my VarChar field from it's current
setting of 30 to 70 or 100?

70 would cover requirements for now, but 100 would definitely cover it, but
if there is any kind of performance degradation, eg when querying, physical
db DB size, etc then I'd like to set it to 70.

Thanks

Robbie


Nov 4 '05 #1
3 1721
Hi,

1) alter table [table_name] modify [column_name] varchar([new_size])
[further options (like NOT NULL, ...)]

2) a varchar takes only as much storage as the content in it + 1 byte for
each row (which saves the size of the field).

So I would rather make it big enough so that you can expect that all the
data you'll store in the future will fit into it.

Markus
Nov 4 '05 #2
On Fri, 04 Nov 2005 11:22:55 +0100, Markus Popp wrote:
2) a varchar takes only as much storage as the content in it + 1 byte for
each row (which saves the size of the field).

So I would rather make it big enough so that you can expect that all the
data you'll store in the future will fit into it.


But bear in mind that there is a limit to index sizes (at least in 4.1,
I'm not a 5.x user yet) so if you have an index on multiple varchar fields
you might hit that limit.

Cheers,
Andy
--
Andy Jeffries | gPHPEdit Lead Developer
http://www.gphpedit.org | PHP editor for Gnome 2
http://www.andyjeffries.co.uk | Personal site and photos

Nov 4 '05 #3
Many thanks Markus

I posted this query in another group and after 5 replies I was still none
the wiser.

In 1 post you have confirmed everything I need to know.

Thanks Robbie
"Markus Popp" <mf*@gmx.li> wrote in message
news:43******** **************@ newsreader01.hi ghway.telekom.a t...
Hi,

1) alter table [table_name] modify [column_name] varchar([new_size])
[further options (like NOT NULL, ...)]

2) a varchar takes only as much storage as the content in it + 1 byte for
each row (which saves the size of the field).

So I would rather make it big enough so that you can expect that all the
data you'll store in the future will fit into it.

Markus

Nov 7 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
7292
by: Warren Wright | last post by:
Hi group, I have a select statement that if run against a 1 million record database directly in query analyzer takes less than 1 second. However, if I execute the select statement in a stored procedure instead, calling the stored proc from query analyzer, then it takes 12-17 seconds. Here is what I execute in Query Analyzer when bypassing the stored procedure:
6
22423
by: Bill | last post by:
In an effort to improve the speed of queries against my main table, I'll be indexing a column whose data type is varchar(50). Would I be better off (better performance) if I changed the column's data type to some numeric type? I would have to update the column's data to accomodate this, but I would do it if this offers a performance gain. -- Bill
7
6218
by: Rick Caborn | last post by:
Does anyone know of a way to execute sql code from a dynamically built text field? Before beginning, let me state that I know this db architecture is built solely for frustration and I hope to make it better soon. Unfortunately, there is never a non-crucial time in which we can do an upgrade, so we are stuck for now. Point 1: There are multiple tables: students, courses, cross-reference
0
1820
by: Oliver Elphick | last post by:
The attached proposal is written primarily for Debian. Its motivation is that the current package upgrade process is pretty flaky and also that the current packaging does not really provide for multiple simultaneous postmasters, which are wanted by people hosting several database clusters. I assume these proposals may also be of interest to Red Hat packagers. I am copying it to the PostgreSQL list in case there are any obvious...
22
11600
by: jdokos | last post by:
Hello, I have a question about VARCHAR fields. Our application groups here are starting to use VARCHARs much more frequently. Even VARCHAR (2) to (9) length fields. They say this is because some of the application programs, specifically Java Beans cannot handle the spaces after the value in CHAR fields. Is anyone else seeing this trend?
6
6456
by: Igor Shevchenko | last post by:
Hi! Suppose I have "pg_dump -s" of two pg installs, one is "dev", another is "production". Their schemas don't differ too much, and I want to get a "diff -u"-like schema diff so I can quickly add missing/remove old tables/sequences/etc to one or another (manually). Is there some quick tool for doing this ? There was a thread about it sometime in aug, 2002, but it ended without producing anything useful.
3
2156
by: Jeff Kish | last post by:
Hi. I'm trying but not getting correct results. I have two tables one with app, msg, time (varchar,datetime,varchar) app1 start 2006-04-03 13:33:36.000 app1 stuff 2006-04-03 13:33:36.000 app1 end 2006-04-03 13:33:36.000
1
1759
by: tepperis | last post by:
hi, the DB2 v. 7 resides on a Z/OS mainframe. we want to support different languages with special local characters for one kind of information. if someone is using hungarian, the string may contain special hungarian characters. if polish is used polish characters should be used...
1
2043
by: dn.perl | last post by:
I have a table t1 with two columns : c11 varchar(32) , c22 varchar(32) The data in the table is : '11', 'aa01' and on upto '11', 'aa50' : total 50 entries '22', 'b01' '22', b'02' '22', b'03' '33', 'c01' to '33', 'c40' : total 40 entries
0
9554
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10136
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9811
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7358
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6640
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5266
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5405
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3509
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2788
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.