in reply to Re^4: Does Search::InvertedIndex module live up to billing?
in thread Does Search::InvertedIndex module live up to billing?

Your compound primary key approach is the right one. Can you show the DDL you used to create the table and set up indexes? Did you try running the query analyzer to see the query plan and make sure your indexes were being used?
  • Comment on Re^5: Does Search::InvertedIndex module live up to billing?

Replies are listed 'Best First'.
Re^6: Does Search::InvertedIndex module live up to billing?
by punch_card_don (Curate) on Oct 21, 2004 at 20:49 UTC
    Sure thing:
    CREATE TABLE `theTable` ( `response_id` smallint(5) unsigned NOT NULL +default '0', `respondent_id` smallint(5) unsigned NOT NULL default '0 +', PRIMARY KEY (`response_id`,`respondent_id`) ) TYPE=MyISAM
    I'm afraid I'm not familiar with this infamous query analyzer - so I'll read up on it on the web.
      You are joining on respondent_id and searching on response_id so you need indexes on both of those. KEY (response_id), KEY (respondent_id)
        OK - I'll try the individual indexes instead of the compound primary key, and changing order of declaration......

        Of course, it take about two hours to repopulate the database, it'll be tomorrow before I have results.

        Thanks for the help! It really is much appreciated.

      Well, I found and tried the EXPLAIN command on the two-column query. Here's what it gave me:
      +-------+--------+---------------+---------+---------+---------------- +----+------+--------------------------+ | table | type | possible_keys | key | key_len | ref + | rows | Extra | +-------+--------+---------------+---------+---------+---------------- +----+------+--------------------------+ | B | ref | PRIMARY | PRIMARY | 2 | const + | 3007 | Using where; Using index | | A | eq_ref | PRIMARY | PRIMARY | 4 | const,B.respond +ent | 1 | Using where; Using index | +-------+--------+---------------+---------+---------+---------------- +----+------+--------------------------+
      Unfortunately I have no idea what this means. More reading...

      Edit by castaway - swapped pre tags for code tags