# Correct way to use WHERE clause?

**URL:** <https://community.influxdata.com/t/correct-way-to-use-where-clause/20747>\
**Category:** InfluxQL\
**Tags:** influxdb\
**Created:** [July 14, 2021, 9:49am UTC](https://community.influxdata.com/t/correct-way-to-use-where-clause/20747 "2021-07-14T09:49:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Belly\_Musketier](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/belly_musketier/32/7093_2.png) [@Belly\_Musketier](https://community.influxdata.com/u/Belly_Musketier)\
**Post date:** [July 14, 2021, 9:49am UTC](https://community.influxdata.com/t/correct-way-to-use-where-clause/20747/1 "2021-07-14T09:49:32Z")

</div>

Hello Community,  
I need some input on the following topic,  
I am currently running InfluxDB 1.8.x and making a following query to DB, `SELECT time as "someMeasuremet.time", name as someMeasuremet.name" from someMeasuremet WHERE "someMeasuremet._level"='${levelVal}'` and as per WHERE clause documentation, we should always put “Tag Keys” inside WHERE for better performance, but in my case I have “someMeasuremet.\_level” as a tag key and also as a field key. So my question is will this make any problem ?

Looking for feedback 🙂

---

<div class="post-metadata">

**Author:** ![Giovanni\_Luisotto](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/giovanni_luisotto/32/4017_2.png) [@Giovanni\_Luisotto](https://community.influxdata.com/u/Giovanni_Luisotto)\
**Post date:** [July 14, 2021, 12:45pm UTC](https://community.influxdata.com/t/correct-way-to-use-where-clause/20747/2 "2021-07-14T12:45:55Z")

</div>

From what I’ve seen so far, the same key can’t exist as a tag and as a field, if that happens (usually for a wrong insert) the latest one to arrive gets renamed to `{keyname}1` or something similar.

Therefore I suggest you have a good look at your fields and tag keys because something should be wrong.

About the WHERE clause:

- The docs suggest using it on tags because they are indexed therefore easy to filter
- You can also filter field values, but that requires a scan of the data (as fields are not indexed). I’m using it, but only for small time ranges or small amount of data anyway and I’ve never had problems
