Does a postgres foreign key imply an index? : <p>I have a postgres table (lets call this table <code>Events</code>) with a composite foreign key to another table (lets call this table <code>Logs</code>). The Events table looks like this:</p>

<pre><code>CREATE TABLE Events (
   ColPrimary UUID,
   ColA VARCHAR(50),
   ColB VARCHAR(50),
   ColC VARCHAR(50),
   PRIMARY KEY (ColPrimary),
   FOREIGN KEY (ColA, ColB, ColC) REFERENCES Logs(ColA, ColB, ColC)
);
</code></pre>

<p>In this case, I know that I can efficiently search for Events by the primary key, and join to Logs.</p>

<p>What I am interested in is if this foreign key creates an index on the Events table which can be useful even without joining. For example, would the following query benefit from the FK?</p>

<pre><code>SELECT * FROM Events
WHERE ColA='foo' AND ColB='bar'
</code></pre>

<p>Note: I have run the POSTGRES EXPLAIN for a very similar case to this, and see that the query will result in a full table scan. I am not sure if this is because the FK is not helpful for this query, or if my data size is small and a scan is more efficient at my current scale.</p>
