# Organizing SQL tables and named queries efficiently

**URL:** <https://forum.inductiveautomation.com/t/organizing-sql-tables-and-named-queries-efficiently/53212>\
**Category:** Ignition\
**Created:** [November 17, 2021, 9:45pm UTC](https://forum.inductiveautomation.com/t/organizing-sql-tables-and-named-queries-efficiently/53212 "2021-11-17T21:45:15Z")\
**Posts on this page:** 1\
**Showing post:** 13

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [December 1, 2021, 10:08pm UTC](https://forum.inductiveautomation.com/t/organizing-sql-tables-and-named-queries-efficiently/53212/13 "2021-12-01T22:08:50Z")

</div>

Event logs are the poster child for “tall” tables. So, option 1, unquestionably.

For efficiency, I would use a numeric foreign key for machine, where a separate, relatively static table of machines has that as a primary key. I would also omit duration, as it is easily generated from `lead(t_stamp) over (partition by machine order by t_stamp)`.

---

_[View the full topic](https://forum.inductiveautomation.com/t/organizing-sql-tables-and-named-queries-efficiently/53212)._
