[Rpm-maint] Feature request: Improved speed for 'rpm -qa'

Michael Schroeder mls at suse.de
Wed Dec 20 13:42:48 UTC 2006

On Tue, Dec 19, 2006 at 07:29:09PM +0100, Axel Liljencrantz wrote:
> Even on my 300 MHz system, it only takes about 0.02 seconds. Is there
> any chance that regular rpm could be made this fast, or is this too
> much of a hack to include there? I don't think that bundling a special
> command for querying the rpm database together with a general purpose
> OS agnostic commandline shell is the proper way to do this...

Well, the program is for a very special case:

- No digest/signature checking
- --qf '%{NAME}\n'

So I don't know if patching rpm for this case is really useful.

> By the way, why is this a hack? Is the index not updated when an entry
> is removed or something? If not, indexes are there to be used!

No, it's a hack because it assumes that the Name Index is in
BerkeleyDB DB_HASH format, while it actually can be configured
in /usr/lib/rpm/macros to be something else.

> I did a comparison, and on my systems the only difference in output
> between your command and 'rpm -qa' is that with your command, packages
> that are installed in multiple versions are only printed once,

This can easily be fixed.

> and that package version numbers are not printed.

That can't be helped. The program is fast because it doesn't need
to read the complete "Packages" database. Reading just the name index
doesn't give you the package versions.


Michael Schroeder                                   mls at suse.de

More information about the Rpm-maint mailing list