469,927 Members | 1,946 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,927 developers. It's quick & easy.

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 1264
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by Berislav Lopac | last post: by
9 posts views Thread by NvrBst | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.