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

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

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

1 Answer 1


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.

Quoting from the schema, the LinkTypeId values are:

  • 1 = Linked (PostId contains a link to RelatedPostId)
  • 3 = Duplicate (PostId is a duplicate of RelatedPostId)

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? Commented Mar 26, 2014 at 13:25
  • @IanRingrose: scratch that, I was wrong. Yes, links in answers are linked from the question id. Commented Mar 26, 2014 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. Commented Mar 26, 2014 at 13:38
  • There is no PostLinkTypes table on SEDE.
    – ashleedawg
    Commented Nov 29, 2019 at 13:10
  • 2
    @ashleedawg: that table appears to have been removed. It was there when this answer was written. Commented Nov 29, 2019 at 21:56

You must log in to answer this question.

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