Programmatically determining if an index is building

Post Reply
barry.marcus
Posts: 288
Joined: Thu Nov 16, 2006 1:05 pm

Programmatically determining if an index is building

Post by barry.marcus »

OK, I hope this question isn't too out of left field... I am building a utility (which will be used infrequently, I'm sure) that will allow the user to build an index without having to know the syntax of CREATE INDEX statament. Since it can take a long time to build an index, I'm also contemplating a way to provide the current build status, on request, to the user. When I create indexes "manually" I check the status by repeatedly getting a directory listing to look at the size and timestamp of the files. If they keep changing, then I know the the process is still alive and the index is still building. I also am aware that for indexes that are in the process of building, the TYPE column in SYSINDEX is lower case for that row.

I guess my question is a general one for guidance... Is simply automating the "methodology" of checking the progress of file sizes and time stamps the best way to go, or is there a different approach that someone might suggest?

Thanks
User avatar
mark
Site Admin
Posts: 5513
Joined: Tue Apr 25, 2000 6:56 pm

Programmatically determining if an index is building

Post by mark »

During index creation you can count on the TYPE being lowercase. Otherwise there's no way to check progress except to look at the size of disk files.

Checking updates to metamorph indices is more interesting since there are multiple files. And the process on windows is a little different than on *nix.
barry.marcus
Posts: 288
Joined: Thu Nov 16, 2006 1:05 pm

Programmatically determining if an index is building

Post by barry.marcus »

Thanks. I suspected that that was the only way.

I'll play around with some ways to programattically monitor the size and timestamps of the various files involved in the metamorph indices.
User avatar
Kai
Site Admin
Posts: 1271
Joined: Tue Apr 25, 2000 1:27 pm

Programmatically determining if an index is building

Post by Kai »

Also look at indexmeter: `set indexmeter=1' will print a bar-graph meter during index create, and indexmeter=2 will print a more-often-updated (but less parse-friendly) meter. You may be able to set indexmeter=1, redirect output to a file, and parse the end of it for your needs.
barry.marcus
Posts: 288
Joined: Thu Nov 16, 2006 1:05 pm

Programmatically determining if an index is building

Post by barry.marcus »

Great tip! Thanks, Kai. I will look at that.
Post Reply