Alan Runyan wrote:
> On Fri, Jan 23, 2009 at 1:45 PM, Shane Hathaway < 
> <>> wrote:
>     => select zoid from current_object where tid != (select max(tid) from
>     object_state where object_state.zoid = current_object.zoid);
>      zoid
>     ------
>         7
>        10
>        12
>        11
>         9
>         8
>     (6 rows)
> Wow.  All of that with some SQL.

Cool, huh?  One caveat: While PostgreSQL executes this query in seconds, 
MySQL 5.0 would likely mis-optimize the subquery and take hours. :-/ 
For MySQL I'd have to use join syntax instead.

> Out of curiosity what would be the process if you were using FileStorage 
> to diagnose the same problem?  Do the same thing by iterating over the 
> entire storage and filling in some structures and doing the comparison 
> manually?

Probably, though ZODB has some pretty good tools for low-level 
FileStorage debugging.

> Sounds like it would take a few hours, with SQL -- it seems 
> pretty straightforward.

I think so too, although with FileStorage it would have been possible to 
guess at the time when the databases were accidentally merged, by 
looking at the position of the bad transactions in the file. 
FileStorage also would have reacted differently to the merged databases, 
though I have no idea how.

> The sooner this gets into the mainline of ZODB -- the better.

Thanks.  Still, FileStorage should always be the default. It's simpler 
and easier to set up than RelStorage.

For more information about ZODB, see the ZODB Wiki:

ZODB-Dev mailing list  -

Reply via email to