Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![Sandro Costa](https://secure.gravatar.com/avatar/6f5bbd502e1f03b7c94d78f085d5331c?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Sandro Costa
13,163 PointsIs there any performance impact in using custom template tags vs a database query passed into the view?
Even though I know DRY is super important nowadays, I'm still trying to understand if custom template tags have any performance impact when rendering the template.
Based on your experience, what do you think?
1 Answer
![Kenneth Love](https://uploads.teamtreehouse.com/production/profile-photos/710512/micro_TeacherShoot-Kenneth.jpg)
Kenneth Love
Treehouse Guest TeacherThey can, yes. Consider having a template tag that causes a large database query that isn't cached and doesn't use handy features like prefetch_related
or select_related
. Maybe it hits a table without any good indexes, too. Worst case scenario kind of thing.
Sticking that tag onto a page, or multiple pages, is going to cause those pages to be really slow. Of course, you'd have the same slowdown doing that query in the view. BUT if your query only really needed to be on, say, two pages, but you used the template tag on 10 pages...