6 ms·
Count Distinct Compared on Top 4 SQL Databases
- svennek 10y agoOh well, a competitor bashing PostgreSQL without knowing what they are seeing. PostgreSQL has an excellent planner, the problem (for count(*) and count-distinct queries) is that PostgreSQL keeps it's visibility information in the actual rows not in a memory structure. The good thing about that is correct transaction semantics (which MSSQL does not always guarantee in the count cases) and never having to fiddle with tuning memory for locking (and having queries cancelled because it runs out!). The bad thing about that is that count is slow (as it needs to hit every row in the table to see if it is visible) and that locking selects (i.e. for update) suddently costs write i/o....