ich habe eine tablelle mit einem primary key und will abfragen folgender art machen:
select *
from tablelle
where attrib1 = 123 and attrib3 = 'gsdfg';
attrib1 ist der primary key, postgres erzeugt dafür einen automatischen index.
ist es nun sonnvoller wenn ich einen index für attrib3 erzeuge oder wenn ich einen index mit attrib1 und attrib3 kombiniert erzeuge, also:
CREATE INDEX table_idx ON table (attrib3);
oder
CREATE INDEX table_idx ON table (attrib1, attrib3);
Lesezeichen