ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

multiple relationships records in exp_relationships?

July 19, 2010 4:19pm

Subscribe [5]
  • #1 / Jul 19, 2010 4:19pm

    trenchard

    128 posts

    I am noticing multiple records for the same relationship in the exp_relationships table.  I am navigating this schema for a customer query, but this complicates it.  Is this expected?

    Mark

  • #2 / Jul 19, 2010 4:33pm

    Ingmar

    29245 posts

    What version and build are you using? Any extensions?

  • #3 / Jul 19, 2010 5:12pm

    trenchard

    128 posts

    1.6.9
    extensions:
    jQuery for CP
    LG .htaccess Generator
    FieldFrame
    LG Better Meta
    EditTab Ajax
    Edit Menu
    EEEvent Helper

  • #4 / Jul 19, 2010 6:36pm

    trenchard

    128 posts

    Because of this issue, I have to use DISTINCT to limit the results set.  That seems strange for what could be a concatenated primary key.  In other words I would expect to see a unique record for each unique relationship with the cache fields updated as needed.

    Here is a sample of the queries we are using…

    SELECT DISTINCT rel_parent_id, d.title as Destination,rel_child_id, t.title as Trail
    FROM exp_relationships,exp_weblog_titles t, exp_weblog_titles d
    WHERE rel_child_id=t.entry_id
    AND rel_parent_id=d.entry_id
    AND rel_child_id
    IN (select entry_id from exp_weblog_titles where weblog_id='2')
    AND rel_parent_id 
    IN (select entry_id from exp_weblog_titles where weblog_id='3')
    ORDER BY `exp_weblog_titles`.`title` ASC
  • #5 / Jul 20, 2010 2:45am

    John Henry Donovan

    12339 posts

    Mark,

    To confirm. You are seeing unique rel_ids with the exact same rel_parent_id and rel_child_id where you are sure only one relationship was created?

    Can you try delete you cache via the control panel please?

  • #6 / Jul 20, 2010 2:57am

    trenchard

    128 posts

    John,

    Yes, unique rel_id’s with same parent/child combination.  See the attached screen-shot.  It looks like we have 2 of each relationship with rel_ids in certain ranges.

  • #7 / Jul 20, 2010 4:08am

    John Henry Donovan

    12339 posts

    Mark,

    Over 4000 relationships looks like a lot. Can you give some more background on this project please?

  • #8 / Jul 20, 2010 11:09am

    trenchard

    128 posts

    I was wondering about this, but this is probably reasonable.  There are actually only about 3000 records in this table despite the ID count.

    This site contains state-wide restaurant listings for a US state.  The 1600 or so listings have a region and city child relationship.  There are 50+ event listings that also have region and city child relationships.  Each city (~25) is related to a region (7).

    It is very relationship heavy which is why I’m concerned that I see doubling of the relationship records.

  • #9 / Jul 20, 2010 7:11pm

    Brandon Jones

    5500 posts

    Hi trenchard,

    What version of EE was the bulk of the site developed on? Were there ever other extensions in the mix?

  • #10 / Jul 20, 2010 7:43pm

    trenchard

    128 posts

    Developed and published on 1.6.9

    We might have had Playa installed for a bit, but we are not using it now.

    I don’t know if this is relevant, but we have Erskine Related Channel Entries Tag module installed.

  • #11 / Jul 21, 2010 3:02am

    John Henry Donovan

    12339 posts

    Mark,

    I don’t know if this is relevant, but we have Erskine Related Channel Entries Tag module installed.

    It might well be. I am not familiar with the Module. If all those relationships are invested in that module then I would suggest a vanilla install with that module installed and try to recreate a segment of your set-up and see if you can reproduce the duplication.

  • #12 / Jul 22, 2010 1:36pm

    trenchard

    128 posts

    I found that we had Playa still installed.  I’ve uninstalled it.  The Erskine module is an extension of the the weblog:entries function so it is not writing to those tables where as Playa would be likely…

    Mark

  • #13 / Jul 22, 2010 1:52pm

    Robin Sowell

    13255 posts

    It’s not impossible that it’s a bug- I’ve been poking something obscure involving msm and relationships.  When you created the second site- did you duplicate the content of the first site?  Not just the weblogs- but the weblog entries, etc?

    (Note- that said- I’m not sure there’s an issue w/needing to use distinct.  The issue I was seeing seems different.)

  • #14 / Jul 22, 2010 5:47pm

    trenchard

    128 posts

    This is not a MSM site so we have never created another site on this instance.

  • #15 / Jul 22, 2010 8:20pm

    Brandon Jones

    5500 posts

    trenchard, thanks for the information. It could be related to those add-ons, so let us know what you find.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases