SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    Nov 2009
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    phpMyAdmin: what size should I enter when adding a new index for a varchar field?

    Hi folks - a newbie question, with apologies. I have a table with only 14,500 rows, which is not likely to increase much over time. I'm trying to index one varchar field (255 chars) to enable fulltext searching, and phyMyAdmin is asking me to enter a size value for the index. I have no idea what this number should be, or indeed how to look up the answer. Thanks.

  2. #2
    SitePoint Wizard
    Join Date
    Mar 2002
    Location
    Bristol, UK
    Posts
    2,240
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Best bet is to leave it blank. For a VARCHAR column the index length is entirely optional.

    If you have to enter a value, then go for 255.

    The length is simply the number of bytes included in the index. So if you specify 100, only the first 100 bytes of the column would be indexed.
    Sam Hastings

  3. #3
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,247
    Mentioned
    59 Post(s)
    Tagged
    3 Thread(s)
    Quote Originally Posted by aloeroot View Post
    I'm trying to index one varchar field (255 chars) to enable fulltext searching
    you have to use the whole column
    Quote Originally Posted by da manual
    Only the MyISAM table type supports FULLTEXT indexes and only for CHAR, VARCHAR, and TEXT columns. Indexing always happens over the entire column and partial (prefix) indexing is not supported.
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  4. #4
    SitePoint Member
    Join Date
    Nov 2009
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks r937 - I should have said I was trying to index the column. SJH - thanks so much!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •