473,387 Members | 1,749 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Is TEXT slower than VARCHAR if the same data is held in both?

Dear Sirs,

Given the following table

CREATE TABLE specifications (
objectId int not null default 0,
paramValue varchar(255) not null default '',
INDEX(objectId)
)

and the query

SELECT * FROM specifications WHERE objectId = x

Would the speed of the query be slower if the paramValue
field were changed to a TEXT field (instead of VARCHAR) ?

I believe that the speed of the query is only dependent
on the datatypes of the queried field (in the WHERE) clause,
is this not so ?

In case you're wondering, I have an object which stores
its attributes in 2 tables: the 'specifications' table
above stores about 50 values which are all less than 255
characters each. Another table stores a longer 'description'
in a TEXT field.

So I have been wondering whether it might be quicker to
store all of the object's properties in one table (changing
the VARCHAR field to a TEXT) and therefore just make
one query.

Thank you very much in advance,

Heather
Jul 20 '05 #1
1 1339
If the objectId is indexed as well as you just did, and the whare case of
your query only depend on objectId - which - fortunately is just what u
planning to do :-)

Go ahead change the type of the paramValue field, it will not slow anthing
down.

Cheers,
ccton

--
www.vicdir.com
"Heather Fraser" <he************@gmail.com> ????
news:47**************************@posting.google.c om...
Dear Sirs,

Given the following table

CREATE TABLE specifications (
objectId int not null default 0,
paramValue varchar(255) not null default '',
INDEX(objectId)
)

and the query

SELECT * FROM specifications WHERE objectId = x

Would the speed of the query be slower if the paramValue
field were changed to a TEXT field (instead of VARCHAR) ?

I believe that the speed of the query is only dependent
on the datatypes of the queried field (in the WHERE) clause,
is this not so ?

In case you're wondering, I have an object which stores
its attributes in 2 tables: the 'specifications' table
above stores about 50 values which are all less than 255
characters each. Another table stores a longer 'description'
in a TEXT field.

So I have been wondering whether it might be quicker to
store all of the object's properties in one table (changing
the VARCHAR field to a TEXT) and therefore just make
one query.

Thank you very much in advance,

Heather

Jul 20 '05 #2

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

Similar topics

7
by: Berislav Lopac | last post by:
I was lately wandering what would be the advantage of using varchar instead of text column data type in a database (specificall MySQL, but this might also be the case for other databases)? I mean,...
5
by: adrian | last post by:
hi all this is my first post to this group, so pls bear with me while i try to make some sense. i am trying to create a sproc which uses dynamic sql to target a particuar table eg. '.' and...
7
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...
15
by: Philip Mette | last post by:
I am begginner at best so I hope someone that is better can help. I have a stored procedure that updates a view that I wrote using 2 cursors.(Kind of a Inner Loop) I wrote it this way Because I...
6
by: Caveman | last post by:
-- I have a situation where doing -- first example -- 1. Get series of values througha query into a string (@val)like '1,2,3,4': declare @val varchar(4000) select @Val = @val + cast(myval as...
2
by: JohnR | last post by:
When creating an msAccess db within the Access UI itself the fields that are text are NOT padded with blanks. For example, if I have a 10 char field and put in "HI" and then when I come back to...
3
by: Daniel Wetzler | last post by:
Dear MSSQL- experts, I have a strange problem with SQLSERVER 2000. I tried to export a table of about 40000 lines into a text file using the Enterprise manager export assitant. I was astonished...
0
Krishna Ladwa
by: Krishna Ladwa | last post by:
In Sql Server 2000 Version, I found that no Notification message box appears when converting text column to varchar but the data gets truncated to the given size for the varchar. Whereas it appears...
9
by: NvrBst | last post by:
Whats the best way to count the lines? I'm using the following code at the moment: public long GetNumberOfLines(string fileName) { int buffSize = 65536; int streamSize = 65536; long...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...

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.