Re: [GENERAL] Indexed views like SQL Server - NOT Materialized Views

2015-06-10 Thread Kevin Grittner
Nicolas Paris wrote: > Would views + partial indexes (based on views predicat) do the trick ?​ I don't see anything promising that way, but feel free to work up a proof of concept patch if you do. -- Kevin Grittner EDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company -- Sent v

Re: [GENERAL] Indexed views like SQL Server - NOT Materialized Views

2015-06-10 Thread Nicolas Paris
2015-06-10 17:43 GMT+02:00 Kevin Grittner : > inspector morse wrote: > > > After doing that, if you add or delete a topic from the Topics > > Table, SQL Server automatically keeps the count updated.and > > it's fast because of the unique index. > > > > Doing the same thing in Postgresql using

Re: [GENERAL] Indexed views like SQL Server - NOT Materialized Views

2015-06-10 Thread Kevin Grittner
inspector morse wrote: > After doing that, if you add or delete a topic from the Topics > Table, SQL Server automatically keeps the count updated.and > it's fast because of the unique index. > > Doing the same thing in Postgresql using Materialized views is > slow and the developer has to man

Re: [GENERAL] Indexed views like SQL Server - NOT Materialized Views

2015-06-09 Thread William Dunn
Though I'm sure you've already looked into it, for your specific issue of getting row counts: - In PostgreSQL 9.2 and above this operation can be made much faster with index-only scans so ensure you are on a recent version and do your count on a column of a candidate key with an index (for example,

[GENERAL] Indexed views like SQL Server - NOT Materialized Views

2015-06-09 Thread inspector morse
SQL Server has a feature called Indexed Views that are similiar to materialized views. Basically, the Indexed View supports COUNT/SUM aggregate queries. You create a unique index on the Indexed View and SQL Server automatically keeps the COUNT/SUM upto date. Example: CREATE VIEW ForumTopicCounts