I have look into Database schema documentation for the public data dump and SEDE.

But there is no explanation about postlinks table. Can anyone explain me the meaning of each column of that table?

  • There are Id, CreationDate, PostId, RelatedPostID and LinkTypeId fields – Gerel tumen Mar 26 '14 at 11:30
  • 1
    Look at the Linked section to the right of your question. I believe your answer lies there. – Frédéric Hamidi Mar 26 '14 at 11:31
  • If a post has duplicates (or has linked posts), this table holds that data. – Aziz Shaikh Mar 26 '14 at 11:32
  • @FrédéricHamidi: The FAQ doesn't actually document that table.. – Martijn Pieters Mar 26 '14 at 11:32
  • @Martijn, I was actually referring to the section itself, not to the content of the FAQ link there :) – Frédéric Hamidi Mar 26 '14 at 11:38
  • @FrédéricHamidi: ah, yes, but that doesn't actually explain the contents of the schema, not as such. :-) – Martijn Pieters Mar 26 '14 at 11:40

The table lists all 'linked' and 'duplicate' links related to a post.

You can use it to query what posts are linked as a duplicate for example.

Schema explanation:


  • Id - primary key
  • CreationDate - when the link was created
  • PostId - id of source post
  • RelatedPostId - id of target post
  • LinkTypeId - type of link (currently either 1, linked, or 3, dupe)

Linked post are any internal link referenced in the question or in answers or comments below a question. Duplicate links are created when the source post has been closed as a duplicate.

The LinkTypeId values are listed in the PostLinkTypes table.

The PostId column only ever refers to questions; the vast majority of RelatedPostId targets are questions too, with about 1000 exceptions (which are answers); it is unclear when the site will insert an answer link instead of a question, but all these exceptions are 'linked' links, not duplicates.

  • For a question does this include links that are in answers? – Ian Ringrose Mar 26 '14 at 13:25
  • @IanRingrose: scratch that, I was wrong. Yes, links in answers are linked from the question id. – Martijn Pieters Mar 26 '14 at 13:32
  • @IanRingrose: I posted a 'see this other answer of mine' reference in a post that I used to test this with; neither the source answer ID nor the target answer are listed in the PostLinks table, but the questions are. So answerA posted on questionA refers to answerB on questionB, and a link was addded from questionA to questionB. – Martijn Pieters Mar 26 '14 at 13:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .