Hi all. I have a question about LDM and creating d...
# gooddata-cloud
g
Hi all. I have a question about LDM and creating datasets with custom SQL query. If I create an SQL Query dataset in the LDM and use it in an insight, when I use a filter, does GoodData query the dataset without the filters and then applies the filters or are the SQL enriched with the filters and sent to the datasource? I want to optimize it by not fetching all the data from the datasource but just the required data
m
Hi Goran, are we speaking about UDF and WDF? They are always included in the query every time your data source is queried. The simplest way to check what's included in the SQL statement generated by the platform is by retrieving the AFM explain from the insight which includes a low-level inspection of the queries that are being sent to database. It can be used also from browser, if you open some specific report using "Analyze" tab and replace the last URL part (
/edit
) with
/debug
. It will download a ZIP archive "explainAfm.zip" containing low-level information about report and its computation, including report.json.qt.opt.sql with actual query that was sent to your database.
g
ah yes, always forgetting that I can use this to analyze it. Thanks @Moises Morales I will do this
🙌 1
Hi @Moises Morales a little follow-up on this thread. I've used the analyze tab and got json info of what is included in the query, but can I get the actual query in SQL?
m
Hello @Goran Jakimovski, it's actually included in the zip. You have to look for the file report.json.qt.opt.sql
g
Hi @Moises Morales it was there but hidden somehow after unzip. Thanks, sorry to bother you
✅ 1