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
This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.
The active forums are here.
July 19, 2010 4:19pm
Subscribe [5]#1 / Jul 19, 2010 4:19pm
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
What version and build are you using? Any extensions?
#3 / Jul 19, 2010 5:12pm
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
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
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
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
Mark,
Over 4000 relationships looks like a lot. Can you give some more background on this project please?
#8 / Jul 20, 2010 11:09am
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
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
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
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
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
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
This is not a MSM site so we have never created another site on this instance.
#15 / Jul 22, 2010 8:20pm
trenchard, thanks for the information. It could be related to those add-ons, so let us know what you find.