Hi, David

On Tue, 21 Jan 2003, David T-G wrote:

> % Are you sure that smallint is enough for your index? Do you really need to
>
> I've thought about that a bit, but don't know if there is a more 'right'
> answer that comes with experience...  In this case and other cases I've
> had so far, it is; that will give me 64k.  Perhaps it's not worth thinking
> about the few bytes a smallint will save me; I already use smallint even
> where tinyint will do just fine for the sake of consistency ("all of my
> ID columns are smallint, so foreign key references can automatically be
> smallint").  Do you suggest that perhaps I just go with int or bigint for
> my IDs, again for consistency but now across all of my work rather than
> just guaranteed within a database?

I would suggest to use INT UNSIGNED. Primary keys are not re-used and with
SMALLINT you could easily run out of numbers.

> % index the full title?
>
> I think so...  If the title is "Let Not the Wise Man Glory in his Wisdom"
> and I want to be able to use 'wisdom' as a keyword for my search, it
> needs to be indexed, right?

 ... that would be a query similar to:

  SELECT * FROM mydb WHERE musictitle LIKE '%wisdom%';

and this will not use the index at all. You have to set up a FULLTEXT
index on your titles or search  LIKE 'let not%'.

Thomas Spahni
-- 
filter: sql, query


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to