<div dir="ltr">please remove me from this list<br><img src="https://t.yesware.com/t/9e9f1d1e5a2e28541a637ca4ea53f093f4944614/da1c4a1882d938d12384e5d7b4162236/spacer.gif" style="border: 0; width: 0px; height: 0px;" width="0" height="0"><img src="http://t.yesware.com/t/9e9f1d1e5a2e28541a637ca4ea53f093f4944614/da1c4a1882d938d12384e5d7b4162236/spacer.gif" style="border: 0; width: 0px; height: 0px;" width="0" height="0"><font face="yw-9e9f1d1e5a2e28541a637ca4ea53f093f4944614-da1c4a1882d938d12384e5d7b4162236--tolfcu" style></font></div>
<div class="gmail_extra"><br clear="all"><div><div dir="ltr"><div style="font-family:arial;font-size:small"><br></div><div style="font-family:arial;font-size:small"><br></div><div style="font-family:arial;font-size:small">
Best,<span><font color="#888888"><br></font></span></div><div style="font-family:arial;font-size:small"><br></div><div style="font-family:arial;font-size:small"><br></div><div style="font-family:arial;font-size:small"><a href="http://linkedin.com/in/ryanmeinzer" style="color:rgb(17,85,204)" target="_blank">Ryan Meinzer</a> | Customer Advocate | <a href="http://heroku.com/" style="color:rgb(17,85,204)" target="_blank">Heroku</a> | +1.215.285.7321 | <a href="https://ryanmeinzer.youcanbook.me/" target="_blank">Schedule a Call with Me</a></div>
</div></div>
<br><br><div class="gmail_quote">On Tue, Mar 11, 2014 at 7:14 PM, Jesus Cea <span dir="ltr"><<a href="mailto:jcea@jcea.es" target="_blank">jcea@jcea.es</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
-----BEGIN PGP SIGNED MESSAGE-----<br>
Hash: SHA256<br>
<div class=""><br>
On 11/03/14 02:49, Matt Chaput wrote:<br>
> How do I get the number of keys in the database inside a<br>
> transaction? I can't see a way to do it in the API. If I just try<br>
> to do len(btree) on a btree I opened with the txn keyword, it locks<br>
> up.<br>
<br>
</div>How many keys do you think you have?. Berkeley DB doesn't have a<br>
counter, so it will iterate over ALL the database. If it is big, it<br>
can take a long time.<br>
<br>
If you need this information frequently and fast, you will need to<br>
keep a counter by yourself, probably not difficult to keep it in sync<br>
if you are using transactions.<br>
<br>
Anyway, what are you looking for is this:<br>
<br>
<a href="http://www.jcea.es/programacion/pybsddb_doc/db.html#stat" target="_blank">http://www.jcea.es/programacion/pybsddb_doc/db.html#stat</a><br>
<br>
Check "nkeys" field. check also the C API, for the "FAST" flag and the<br>
traversal of the tree:<br>
<<a href="http://docs.oracle.com/cd/E17076_03/html/api_reference/C/dbstat.html" target="_blank">http://docs.oracle.com/cd/E17076_03/html/api_reference/C/dbstat.html</a>><br>
<br>
Hope it helps.<br>
<br>
- --<br>
Jesús Cea Avión                         _/_/      _/_/_/        _/_/_/<br>
<a href="mailto:jcea@jcea.es">jcea@jcea.es</a> - <a href="http://www.jcea.es/" target="_blank">http://www.jcea.es/</a>     _/_/    _/_/  _/_/    _/_/  _/_/<br>
Twitter: @jcea                        _/_/    _/_/          _/_/_/_/_/<br>
jabber / <a href="mailto:xmpp%3Ajcea@jabber.org">xmpp:jcea@jabber.org</a>  _/_/  _/_/    _/_/          _/_/  _/_/<br>
"Things are not so easy"      _/_/  _/_/    _/_/  _/_/    _/_/  _/_/<br>
"My name is Dump, Core Dump"   _/_/_/        _/_/_/      _/_/  _/_/<br>
"El amor es poner tu felicidad en la felicidad de otro" - Leibniz<br>
-----BEGIN PGP SIGNATURE-----<br>
Version: GnuPG v1<br>
Comment: Using GnuPG with Thunderbird - <a href="http://www.enigmail.net/" target="_blank">http://www.enigmail.net/</a><br>
<br>
iQEcBAEBCAAGBQJTH8LpAAoJEGjgN61Khv5Dzk8H/RgBxgLp/DnYVb7a0WyxZTMJ<br>
Pc+yzles0sXKoD38RnU3lpsnh7yHasuoy+5JMGDW3Whx51Z5SmHKiycWRd2oxolS<br>
+foiZGQg6C2cae1SexxhDMNr7E/qlHd8MiSeDoshYRAsLFhuL1I5iE+GVetw4PN+<br>
buZRBEQTR2uTf5NDxU2o3lrQrwCX8gYEBBivPIly8Qo8ewk7ZzziQdkzZKy00oaH<br>
8eR9c7Kyp/MNRD/MWQ7VIEfNelmi9N56JOCjGUz4BprFl1Tfd6N3hfuUnwOLRisa<br>
9SC56EmSiAK7U28K5YPo1U6oC97tK8eZkhaQEQd5EmxMzebXjkFZ63D6z5qvdAw=<br>
=OYL8<br>
-----END PGP SIGNATURE-----<br>
<div class="HOEnZb"><div class="h5">_______________________________________________<br>
pybsddb mailing list<br>
<a href="mailto:pybsddb@jcea.es">pybsddb@jcea.es</a><br>
<a href="https://mailman.jcea.es/listinfo/pybsddb" target="_blank">https://mailman.jcea.es/listinfo/pybsddb</a><br>
<a href="http://www.jcea.es/programacion/pybsddb.htm" target="_blank">http://www.jcea.es/programacion/pybsddb.htm</a></div></div></blockquote></div><br></div>