5 ms·
Are you sure the leftover temp table thing still exists? I have been using postgres for development on a project with temp tables and even though of being rough
by the_mitsuhiko 10y ago
Are you sure the leftover temp table thing still exists? I have been using postgres for development on a project with temp tables and even though of being rough with postgres (killing, starting laptop in not so nice ways etc.) i can't find any leftovers.
- limaoscarjuliet 10y agoLeftovers will happen only when number of used temp namespaces before crash is larger than number used after crash. Then not all temp namespaces get reused and, as a result, reset after recovery. The leftovers then keep the XID around forever.
- anarazel 10y agoThat doesn't sound right: static void do_autovacuum(void) { ... if (classForm->relpersistence == RELPERSISTENCE_TEMP) { int backendID; backendID = GetTempNamespaceBackendId(classForm->relnamespace); /* We just ignore it if the owning backend is still active */ if (backendID == MyBackendId || BackendIdGetProc(backendID) == NULL) { /* * We found an orphan temp table (which was probably left * behind by a crashed backend). If it's so old as to need * vacuum for wraparound, forcibly drop it. Otherwise just * log a complaint. */ if (wraparound) { ObjectAddress object; ereport(LOG, (errmsg("autovacuum: dropping orphan temp table \"%s\".\"%s\" in database \"%s\"", get_namespace_name(classForm->relnamespace), NameStr(classForm->relname), get_database_name(MyDatabaseId)))); object.classId = RelationRelationId; object.objectId = relid; object.objectSubId = 0; performDeletion(&object, DROP_CASCADE, PERFORM_DELETION_INTERNAL); } else { ereport(LOG, (errmsg("autovacuum: found orphan temp table \"%s\".\"%s\" in database \"%s\"", get_namespace_name(classForm->relnamespace), NameStr(classForm->relname), get_database_name(MyDatabaseId)))); } }
- limaoscarjuliet 10y agoAye, my stuff was from 9.1, seen it with my own eyes. I'm glad it improved since!
- anarazel 10y agoIt's pretty much the same in 9.1.