are you specifying OBJTYPE?
DSPOBJD OBJ(*ALL/*ALL) OBJTYPE(*QRYDFN) only takes a few seconds to run on our system (>66k files in in 116 libraries. only a small percentage of those files are query definitions.)
The first time the DSPOBJD runs, it takes < 10 seconds, after that, it returns very quickly, the DSPOBJD for a single library would probably run very fast.
Generating a “query list” implies DSPOBJD OUTPUT(*OUTFILE). The outfile is full of detail info about each object. The <a href=”http://publib.boulder.ibm.com/infocenter/iseries/v5r4/index.jsp?topic=/apis/quslobj.htm”>QUSLOBJ (List Objects) API</a> provides an important clue about returning full information about objects: “For performance reasons, you should choose the format that returns only as much information as you need. The higher the number of the format name, the more information is returned and the more time it takes to process.”
There are nine formats in which QUSLOBJ can return info, each one taking longer to fulfill. If you want nothing but a simple list of names, such as WRKQRY can use, a list can be built relatively quickly. The list isn’t built into a database file; that would slow things down. DSPOBJD not only returns most object info; it also writes each item to a database file.
So, if the list as what you need, call the API and request format OBJL0100. Or put up with any delay.