SAN FRANCISCO — Entering Tuesday’s game against the Giants, Pat Valaika was mired in a horrible 0-for-30 slump that had him four outs away from breaking the Rockies record for consecutive hitless at-bats.

But the 26-year-old infielder, who has been up and down from Triple-A Albuquerque over the past three seasons, isn’t losing faith in himself to turn it around offensively.

“I feel like I’ve had some good at-bats up here that I can build on,” Valaika said. “Prior to (being recalled June 18), I was feeling pretty good. It’s all about confidence. … The moment I lose that, I’ve got no chance.”

Valaika has hit just .050 (2-for-40) in 21 games this year, with a .156 on-base percentage, but has torn it up for the Isotopes with a .339 average and 16 homers in 44 games. Manager Bud Black said the disparity between Valaika’s performance in Triple-A and his performance in the bigs can be attributed to two main issues.

“More than anything, like a lot of players who struggle, there’s a strong tendency to press,” Black said. “I think there’s tension in Pat’s swing — he’s got to relax a little bit and get back to basics. Plus, his timing’s off. He’s ahead of the breaking ball and behind the fastball. When you’re in that mode, it makes it tough.”

The former ninth-round draft pick out of UCLA hit .156 in 58 games last year after a promising 2017 season that saw him lead the majors in pinch-hit runs, doubles and extra-base hits while batting .258 overall. Valaika said he sometimes references video from that season to remind himself of his potential.

“Sometimes I’ll look back at it, but it’s tough to recreate things that were two years ago,” Valaika said. “But going back to that, I know I can compete at this level and do well at this level. It’s in me. It’s about getting in the right frame of mind.”

And with Brendan Rodgers headed to the 10-day injured list with right shoulder inflammation on Tuesday, joining Trevor Story (right thumb sprain) on the sideline, the Rockies are suddenly somewhat thin at shortstop. Hence, Valaika figures to get more opportunity to straighten himself out over the next coupleof weeks while sharing time in the position with rookie Garrett Hampson.

“You know how you get out of it? You get out of it,” Black said. “He’s going to keep going up there, and there will certainly be some cage work and minor adjustments made there in between.”

Longest hitting droughts in Rockies history

Desi Relaford, 33 (2005)

Pat Valaika, 30 (2019)

Chris Iannetta, 29 (2007)

Andres Galarraga, 28 (1996)

Jordan Pacheco, 27 (2013)

Carlos Gonzalez, 27 (2017)

On Deck

Rockies RHP German Marquez (7-3, 4.32 ERA) at Giants RHP Jeff Samardzija (4-6, 4.23)

1:45 p.m. Wednesday, Oracle Park

TV: None

Radio: 850 AM/94.1 FM

Marquez looks to pick up where he left off in his last outing, an eight-inning, one-run gem in a loss to the Los Angeles Dodgers last week. The right-hander has been hit at a .297 clip (22-for-74) by the Giants, including a homer by veteran catcher Buster Posey. It will be Marquez’s first outing at Oracle Park since April 14, when he flirted with a no-hitter in a one-hit shutout. Meanwhile, Samardzija has been lit up in two consecutive outings and hasn’t posted a quality start since June 2. Colorado has a .304 collective average against him (66-for-216), and five Rockies have taken him deep.

Trending: A collective disaster through the first couple of months of the season, Colorado’s rotation is starting to show promise. Heading into Tuesday, Rockies starting pitchers had notched five quality starts and a 1.99 ERA in the first seven games of the current nine-game road trip.

At issue: It has been a while since the Rockies walked away from the China Basin with a series victory, which they were trying to clinch with a win Tuesday. Colorado hadn’t won a series in San Francisco since winning three of four against the Giants on April 13-16, 2017.

Upcoming pitching matchups

Thursday: Dodgers LHP Hyun-Jin Ryu (9-1, 1.27 ERA) at Rockies RHP Peter Lambert (2-0, 5.85), 6:40 p.m., ATTRM

Friday: Dodgers RHP Kenta Maeda (7-4, 3.76) at Rockies RHP Antonio Senzatela (6-5, 4.91), 6:40 p.m., ATTRM

Saturday: Dodgers LHP Clayton Kershaw (7-1, 3.07) at Rockies RHP Jon Gray (8-5, 3.92), 6:15 p.m., ATTRM