Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagesql
alter tablespace marmotta_1 set (seq_page_cost = 2);

 

Finally, we altered the column definition for triples.context to change the way PostgreSQL analyzes it.  We told it to consider a larger number of most-frequent distinct values for the column, which leads to a more accurate estimated distinct-value count being made available to the Query Planner.  This requires more storage for this table's statistics, and makes it take longer to analyze, which is why PostgreSQL's default is lower.  You have to make it do extra work for you if you have a table with unusual characteristics.

Code Block
languagesql
alter table triples alter column context set statistics 5000;

Following these changes, queries that used to take four seconds or more to complete – sometimes up in the 20 second range – began taking milliseconds.