Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Performance Issue with "FROM" query (maybe not a bug) #2479

Open
efirlus opened this issue Nov 18, 2024 · 1 comment
Open

Performance Issue with "FROM" query (maybe not a bug) #2479

efirlus opened this issue Nov 18, 2024 · 1 comment
Labels
bug Something isn't working.

Comments

@efirlus
Copy link

efirlus commented Nov 18, 2024

What happened?

No big deal, my vault has 8 directories, and I use a query that watches 3 of them and lists “documents created today”.

The key point is that for each additional folder, I do a FROM -“Adir” -“Bdir” and so on.

I don't know when, but roughly around 4000 documents, Obsidian started to get really heavy.
After 6000, I had to turn off dataview altogether on mobile.

I just found a solution, but I'm not a programmer so I don't know the exact cause.

In conclusion, FROM “6” AND “7” AND “8” is much more pleasant than FROM -“1” AND -“2”.... AND -“5”
Maybe there's something wrong with the part that handles the - that I'm not aware of.

DQL

TABLE dateformat(file.mtime, "HH:mm:ss") as Time, tags
FROM "3. Project" AND "4. Storage" AND "5. Article"
WHERE file.mday = this.file.day
SORT file.mtime desc

JS

No response

Dataview Version

0.5.67

Obsidian Version

1.7.6

OS

Windows

@efirlus efirlus added the bug Something isn't working. label Nov 18, 2024
@holroy
Copy link
Contributor

holroy commented Dec 28, 2024

Doing FROM "A" vs FROM -"B" is vastely different from a programming point of view. Imagine having 100 files in each of the folders from "A" through "Z" (so a total of 2700 files). The first variant checks the file lists, and continue the query only looking at the 100 files from the "A" folder. The second variant checks the entire file list, eliminates the 100 files from "B", and continues to look at the remaining 2600 files.

So in the first case, the WHERE clause looks at a 100 files, and in the second it looks at 2600 files. So if you're able to, you should always limit the FROM as much as possible to reduce the load for the rest of the query.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working.
Projects
None yet
Development

No branches or pull requests

2 participants