Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7958541
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T04:26:19+00:00 2026-06-04T04:26:19+00:00

I have the WordNet lexical database in MySQL. I am looking to find synonyms

  • 0

I have the WordNet lexical database in MySQL. I am looking to find synonyms of given words. Currently the data is set out in three tables as a many-to-many relationship:

words – (147,000 rows)

wordid, word

synsets – (119,000 rows)

synsetid

sense – (206,000 rows)

wordid, synsetid

All tables have indexes set up on them.

Each word can have several synsets and each synset can have several words. I am looking to return all words for all synsets for a given word. There tends to be around 2 synsets for each word (one for the verb usage, one for the noun) The SQL query I’m using for this is:

SELECT w.word
FROM sense s
INNER JOIN words w
ON s.wordid = w.wordid
WHERE s.synsetid 
IN
(
SELECT s.synsetid
FROM words w
INNER JOIN sense s
ON w.wordid = s.wordid 
WHERE w.word = "word_to_search"
)
AND w.word <> 'word_to_search' ORDER BY synsetid

This seems to be taking a very long time however (~0.75 secs). When you split the queries up they take ~0.0005 secs for the inner query and similar for each of the outer queries.

So what am I doing wrong? Is there a much more appropriate way to structure this query?

EDIT:

So the solution I have come up with after reading the linked articles below is:

SELECT w.word
FROM sense s
INNER JOIN words w
ON s.wordid = w.wordid
JOIN
(
SELECT s.synsetid
FROM words w
INNER JOIN sense s
ON w.wordid = s.wordid 
WHERE w.word = "word_to_search"
) i
ON i.synsetid = s.synsetid

This executes in ~0.0008 sec.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T04:26:20+00:00Added an answer on June 4, 2026 at 4:26 am

    avoiding IN and NOT IN (in your case just IN) with INNER JOIN ON could boost performance.

    edit:

    These links:

    link 1

    link 2

    research the effectiveness of JOINS vs IN’s and other interchangeable operations. They, however, conclude that IN and NOT IN does not need to be avoided.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a large readonly Wordnet PostgreSQL database that I'd like to use from
Have a MySQL database table with 2 columns: id, url The url column has
I am using wordnet java API. I have defined a WordNetDatabase database = WordNetDatabase.getFileInstance();
Have you any idea how to find out if spell check suggestions dialog is
We have a client who is looking for a means to import and categorize
I have been looking at the nlp tag on SO for the past couple
Have the following cronjob set up in root's crontab: (centos 5.x) 2 * *
Have a long running set of discrete tasks: parsing 10s of thousands of lines
The assignment, for my data structures class, is to find the shortest path from
Have been trying for hours - unfortunately I'm stuck on this three-table join. The

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.