Results 1 to 5 of 5
  1. #1
    cwillson is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2017
    Posts
    17

    Help needed to make wildcard LIKE query more efficient...

    Hiya,



    I have two tables and am using a LIKE wildcard to identify fields which are similar. I've used this successfully with other, smaller tables, but think I might be struggling due to the size of each on this occasion.

    Table ACC_A has 19000 rows and Table CMS_A_LATEST has 10000.

    The query I am using is as follows:

    SELECT DISTINCT CMS_A_LATEST.CMS_ARTICLE_ID, CMS_A_LATEST.CMS_HEADWORD, ACC_A.HEADWORD AS ACC_HEADWORD, ACC_A.ID AS ACC_ARTICLE_ID
    FROM CMA_A_LATEST, ACC_A
    WHERE CMS_A_LATEST.CMS_HEADWORD LIKE "*" & ACC_A.HEADWORD & "*";

    Is it the use of "SELECT DISTINCT" or simply the volume of data I'm asking the engine to compare that's causing the issue?

    Are there any ways to make this query more efficient perhaps?

    I'm still a real newbie to Access/SQL so completely accept I may be missing something obvious here!!

    Many thanks in advance,

    Chris

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    The use of DISTINCT, AND lots of fields will not get many distinct records.
    Using it with 1 (or 2) fields will give you only unique records.

    Try different queries, but with single fields if you want distinct.

  3. #3
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,716

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,815
    It's the lack of explicit relationship that makes the query perform slowly. Without a JOIN clause query will invoke Cartesian relationship - every record of each table will associate with every record of other table - that means 10000 x 19000 records. I would say 190,000,000 is rather large volume to process.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    cwillson is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2017
    Posts
    17
    Quote Originally Posted by June7 View Post
    It's the lack of explicit relationship that makes the query perform slowly. Without a JOIN clause query will invoke Cartesian relationship - every record of each table will associate with every record of other table - that means 10000 x 19000 records. I would say 190,000,000 is rather large volume to process.
    Hi June7,

    Yes, I feared this would be the case. Unfortunately, there are no persistent references between data-sets, so I'm having to rely on a text string match to identify these...which make it very challenging. The text strings (the "headwords"), by their very nature, will not be precisely the same within each table, hence why I'm using the wildcard reference.

    Horribly large and messy data sets.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 5
    Last Post: 09-12-2014, 06:41 AM
  2. Replies: 9
    Last Post: 12-05-2013, 11:48 AM
  3. Replies: 5
    Last Post: 10-24-2013, 04:38 PM
  4. More efficient way to create a query?
    By Kirsti in forum Queries
    Replies: 3
    Last Post: 07-04-2012, 10:36 PM
  5. Parameter Query & Wildcard
    By Rick West in forum Queries
    Replies: 8
    Last Post: 12-29-2009, 10:54 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums