# Named Queries vs. queries in script library - Best Practices

**URL:** <https://forum.inductiveautomation.com/t/named-queries-vs-queries-in-script-library-best-practices/105841>\
**Category:** Ignition\
**Tags:** ignition81, scripting\
**Created:** [May 2, 2025, 7:48pm UTC](https://forum.inductiveautomation.com/t/named-queries-vs-queries-in-script-library-best-practices/105841 "2025-05-02T19:48:50Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [May 3, 2025, 1:07am UTC](https://forum.inductiveautomation.com/t/named-queries-vs-queries-in-script-library-best-practices/105841/4 "2025-05-03T01:07:01Z")

</div>

> [@hw79](#):
>
> I remember reading that it was a better practice to write queries in a script library instead of using named queries

Generally, named queries are considered to be the better practice however, it is situational.

> [@runprepQuery or runNamedQuery - Best Practice](https://forum.inductiveautomation.com/t/runprepquery-or-runnamedquery-best-practice/85792/2):
>
> With the exception of some special cases (ahmmm QueryString parameters). You should almost always default to Named Queries. Performance wise, I doubt there is anything more than negligible gains or losses between the two functions in a scripting environment. They both use the same JDBC driver, so the same queries will basically run exactly the same. Although, I will admit that I don't know if Named Query caching applies to the scripting function or just bindings, so that could make a differe…

---

_[View the full topic](https://forum.inductiveautomation.com/t/named-queries-vs-queries-in-script-library-best-practices/105841)._
