Obsidian freezes for ±10 seconds for simple query

Continuing from here…

TABLE dateformat(file.mtime, "dd MMM HH:mm") as Updated, status
FROM #task
WHERE status.status-type != "completed"
WHERE !contains(file.path, "Templates")
WHERE priority = [[]]
SORT file.mtime DESC

This query results in 107 results - it freezes my OBS for ±5-10 seconds (also if I accidentally hover over the page with this query)

Am I missing something? Is there a trick to prevent this? Of course I know about LIMIT, but not something I wanna use unless it’s over 500 items.

I’m unsure how Dataview handles multiple WHERE … did you try using AND instead?

Do not understand your query, so I’m just guessing with this one …

```dataview
TABLE dateformat(file.mtime, "dd MMM HH:mm") as Updated, status
FROM #task
WHERE status.status-type != "completed"
AND !contains(file.path, "Templates")
AND priority = [[]]
SORT file.mtime DESC
```

Cheers, Marko :nerd_face:

This is a query that shows on my Low page (each priority is a page, so any task status/priority/any_value becomes clickable).

Using AND did improve opening the page a bit, but everytime I hover over (often accidentally) “Low” still freezes OBS. I like the hovering though, not something I’d want to disable…

Try to LIMIT on some small number … 50, 20, 10 … just that you see if query is slow or “printing out results”.

Cheers, Marko :nerd_face:

The main page is loading in ±1 second with AND (was a bit tricky to test, because as soon as I try to click the page, it already freezes because of the hover preview that already started rendering) .

So it seems the previews are the main culprit here? Not sure how to debug this?

Appreciate your fast responses Marko!

What is priority = [[]]?
Is it not intended as WHERE priority = []?

This is the “beauty” of Dataview :wink: I have the same question as @Yurcee asked. As [[]] is usually for links … :thinking:

Cheers, Marko :nerd_face:

From my knowledge [[]] is “to this file” - I’m not sure if [] does the same? Can check in a bit.

Edit; single brackets doesn’t work.

OK, I see where you got this … Sources - Dataview

You can implicitly reference the current file via [[#]] or [[]], i.e. [[]] lets you query from all files linking to the current file.

But I’m afraid of this sentence “[[]] lets you query from all files linking to the current file.”. Can you try with [[#]]. But could be the same. I guess that it’s checking every linked file … :thinking:

Cheers, Marko :nerd_face:

Adding a # in between also results in no results.

The field I’m querying is basically just a page in a text property field.

priority: [[High]]

As per docs;

The WHERE data command will only keep those lines from the result set which match a given condition. This means that, unless all data in the result set matches the condition, this command will pass on a smaller result set to the next line than it received from the previous line. Unlike in SQL, you can have as many WHERE commands as you like.

Theoretically it should work (like it did), but using AND may be better for performance (as we just learned). It would be really helpful if we somehow could see how long every line in the query took to complete, especially if optimising queries becomes important (large datasets…?).