[pybsddb] How to get Btree len inside a transaction?

Ryan Meinzer ryan at heroku.com
Wed Mar 12 17:21:43 CET 2014


please remove me from this list



Best,


Ryan Meinzer <http://linkedin.com/in/ryanmeinzer> | Customer Advocate |
Heroku <http://heroku.com/> | +1.215.285.7321 | Schedule a Call with
Me<https://ryanmeinzer.youcanbook.me/>


On Tue, Mar 11, 2014 at 7:14 PM, Jesus Cea <jcea at jcea.es> wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
>
> On 11/03/14 02:49, Matt Chaput wrote:
> > How do I get the number of keys in the database inside a
> > transaction? I can't see a way to do it in the API. If I just try
> > to do len(btree) on a btree I opened with the txn keyword, it locks
> > up.
>
> How many keys do you think you have?. Berkeley DB doesn't have a
> counter, so it will iterate over ALL the database. If it is big, it
> can take a long time.
>
> If you need this information frequently and fast, you will need to
> keep a counter by yourself, probably not difficult to keep it in sync
> if you are using transactions.
>
> Anyway, what are you looking for is this:
>
> http://www.jcea.es/programacion/pybsddb_doc/db.html#stat
>
> Check "nkeys" field. check also the C API, for the "FAST" flag and the
> traversal of the tree:
> <http://docs.oracle.com/cd/E17076_03/html/api_reference/C/dbstat.html>
>
> Hope it helps.
>
> - --
> Jesús Cea Avión                         _/_/      _/_/_/        _/_/_/
> jcea at jcea.es - http://www.jcea.es/     _/_/    _/_/  _/_/    _/_/  _/_/
> Twitter: @jcea                        _/_/    _/_/          _/_/_/_/_/
> jabber / xmpp:jcea at jabber.org  _/_/  _/_/    _/_/          _/_/  _/_/
> "Things are not so easy"      _/_/  _/_/    _/_/  _/_/    _/_/  _/_/
> "My name is Dump, Core Dump"   _/_/_/        _/_/_/      _/_/  _/_/
> "El amor es poner tu felicidad en la felicidad de otro" - Leibniz
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1
> Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
>
> iQEcBAEBCAAGBQJTH8LpAAoJEGjgN61Khv5Dzk8H/RgBxgLp/DnYVb7a0WyxZTMJ
> Pc+yzles0sXKoD38RnU3lpsnh7yHasuoy+5JMGDW3Whx51Z5SmHKiycWRd2oxolS
> +foiZGQg6C2cae1SexxhDMNr7E/qlHd8MiSeDoshYRAsLFhuL1I5iE+GVetw4PN+
> buZRBEQTR2uTf5NDxU2o3lrQrwCX8gYEBBivPIly8Qo8ewk7ZzziQdkzZKy00oaH
> 8eR9c7Kyp/MNRD/MWQ7VIEfNelmi9N56JOCjGUz4BprFl1Tfd6N3hfuUnwOLRisa
> 9SC56EmSiAK7U28K5YPo1U6oC97tK8eZkhaQEQd5EmxMzebXjkFZ63D6z5qvdAw=
> =OYL8
> -----END PGP SIGNATURE-----
> _______________________________________________
> pybsddb mailing list
> pybsddb at jcea.es
> https://mailman.jcea.es/listinfo/pybsddb
> http://www.jcea.es/programacion/pybsddb.htm
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.jcea.es/pipermail/pybsddb/attachments/20140312/d0d5d551/attachment.html>


More information about the pybsddb mailing list