WASHINGTON — Robert S. Mueller III, the director of the Federal Bureau of Investigation, warned Wednesday that dismantling the National Security Agency’s once-secret program that is keeping records of billions of domestic phone calls by Americans would slow down investigators as they seek to stop terrorist attacks.

Testifying before the Senate Judiciary Committee, Mr. Mueller addressed a proposal to require telephone companies to retain calling logs for five years — the period the N.S.A. is keeping them — for investigators to consult, rather than allowing the government to collect and store them all. He cautioned that it would take time to subpoena the companies for numbers of interest and get the answers back.

“The point being that it will take an awful long time,” Mr. Mueller said.

Gen. Keith B. Alexander, the director of the N.S.A., had hinted at a House hearing on Tuesday that he was evaluating changes to the domestic calling log program and that he would eventually report back to Congress on the advantages and disadvantages of changing it. He also raised the issue of “speed in crisis” as a major detractor.

In his testimony, Mr. Mueller provided more details about why national security officials were reluctant to take such a step. First, he said, under current law companies are not required to retain such records, and some dispose of them much sooner than five years. Second, rather than being able to instantly query the complete database to see who a suspect has been in contact with, he said, investigators would have to present legal paperwork to a half-dozen carriers and wait for them to gather and provide the records.