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
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
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
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,
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