Searching a hash File
Moderators: chulett, rschirm, roy
Searching a hash File
Does anyone know a way to search for a row in a hash file either with a unix command or in Administrator. Basically I want to grep for a row but im not sure how to do this with a hash file.
Thanks
Aaron
Thanks
Aaron
-
- Participant
- Posts: 35
- Joined: Mon Nov 15, 2004 9:46 am
-
- Participant
- Posts: 35
- Joined: Mon Nov 15, 2004 9:46 am
Yes, you'd have to skip every time your search failed, viewing 9999 rows at a time. Sounds like too much fun. If your record was at the very bottom, you wouldn't find it until after you skipped 10202 times.als110 wrote:Craig there are over 102 million rows in my hash file this option is not feasible.chulett wrote:Why not 'View Data' and then use the Find option there?
Thanks
Joey
-
- Participant
- Posts: 35
- Joined: Mon Nov 15, 2004 9:46 am
Therefore, my solution would be more efficient. You can run it and go eat lunch and come back to your record!jmessiha wrote:Yes, you'd have to skip every time your search failed, viewing 9999 rows at a time. Sounds like too much fun. If your record was at the very bottom, you wouldn't find it until after you skipped 10202 times.als110 wrote:Craig there are over 102 million rows in my hash file this option is not feasible.chulett wrote:Why not 'View Data' and then use the Find option there?
Thanks
Joey
Thanks,
Chester
Chester's way seems like the only way, and will perform at O(n) worst-case efficiency since you are searching for the primary key and not the natural key. I don't think there is a better way, so you'll have to wait for the search to come back.als110 wrote:That works but I'm not sure how well it will work with 102 million rows. I tried is on a smaller has file of 2 million and it take about 5 min to return.chesterkchu wrote:Hi Aaron,
Try LIST filename WITH columnname = 'value'
Thanks,
Chester
Thanks
I you need to do this search repeatedly, you can do a "CREATE.INDEX {TableName} {ColumnName}" and subsequent commands LIST commands on that column will automatically use the index. The CREATE.INDEX command will take a bit of time to create, though.
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
If you are searching for the primary key, the row will be returned instantly irrespective of its location.
Why?
The key value is processed by a hashing algorithm that returns the address of the page on which the key and its record are stored. One I/O operation is required to retrieve that page.
If you are searching based on any other criterion the hashed file behaves like any other database table (which ultimately is what it is). As Arnd suggested, your search can be speeded if the field(s) required in your search criteria are indexed.
Finally, there is no utility for doing this from the operating system prompt; you must be executing a query in the database environment. Get to this from the operating system prompt using the dssh or uv command. Either can take your query (surrounded by double quotes) as a command line argument.
Why?
The key value is processed by a hashing algorithm that returns the address of the page on which the key and its record are stored. One I/O operation is required to retrieve that page.
If you are searching based on any other criterion the hashed file behaves like any other database table (which ultimately is what it is). As Arnd suggested, your search can be speeded if the field(s) required in your search criteria are indexed.
Finally, there is no utility for doing this from the operating system prompt; you must be executing a query in the database environment. Get to this from the operating system prompt using the dssh or uv command. Either can take your query (surrounded by double quotes) as a command line argument.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.