Opened 13 years ago

Closed 12 years ago

#818 closed defect (fixed)

ANALYZE does not override statistics on empty table

Reported by: strk Owned by: pramsey
Priority: medium Milestone: PostGIS 2.0.0
Component: postgis Version: master
Keywords: Cc:

Description

Dunno if postgis can do anything here or is a postgresql thing. What happens is that there seems to be no way to clear statistics of a table after truncating it.

Try with st_estimated_extent: fill a table, analyze, get estimated extent, truncate, vacuum and analyze again, get estimated_extent again: you'll obtain the old estimate.

Change History (6)

comment:1 by strk, 13 years ago

Oh, this is against postgresql 8.4.3

comment:2 by strk, 13 years ago

geometry_gist_selectivity.c and lwgeom_estimate.c both contain a static compute_geometry_stats function. What's the deal ?

comment:3 by mcayland, 13 years ago

IIRC Paul found a performance regression between the old and new index code, and so currently both versions are built to allow for testing/comparison.

comment:4 by strk, 12 years ago

As of r8869 there's a single implementation of compute_geometry_stats, which is good.

comment:5 by strk, 12 years ago

I see from PostgreSQL source code that our custom stats gathered is not even invoked if there are no rows, so the best we could do is reset the stats at the time of the typanalyze call.

comment:6 by strk, 12 years ago

Resolution: fixed
Status: newclosed

r8870 doesn't override statistics but changes st_estimated_extent to deal with the empty table case by looking at the core statistics (row count).

Such change fixes the TRUNCATE effect. I don't think we care about having correct statisticts on empty tables for other uses as any plan the planner makes it will still be very fast for an empty table…

Note: See TracTickets for help on using tickets.