Creating an Inverted Indexing System Using MySQL

I am creating a mobile service that requires a lot of search queries.

The service is based on a MySQL database, and a search query is not enough for a quick search.

So I decided to use an inverted indexing system:

index    Documents
1        a, b, c, d, e, f, g, h
2        c, k, i, j, k

This is a simple design for an inverted indexing system.

I assume that in one line there will be more than a thousand documents.

I'm not sure what type and length I should use for the Documents column?

At the moment, I have chosen VARCHAR (100000). Is it possible to set the length as 9999999?

+3
source share
2 answers
  • Data structure:

    index document
      1      a
      1      b
      1      c
     ...
      2      c
      2      k
    

    indexenter INT, documenttype CHAR(1). Primary key as a set indexand document.

    .
    , , , normalized.

  • MySQL 5.0 ( CHAR VARCHAR ):

[...] VARCHAR [...] 0 255 MySQL 5.0.3 0 65535 5.0.3 .

+9

IMHO, , , , varchar , TEXT, mediumTEXT longTEXT:

TEXT    65,535 bytes    ~64kb
MEDIUMTEXT   16,777,215 bytes   ~16MB
LONGTEXT    4,294,967,295 bytes ~4GB
+1

All Articles