2 Replies Latest reply on Nov 15, 2016 7:17 AM by wiem bekir

    Query optimisation

    wiem bekir

      Hello Guys


      I hope everything is fine.


      I have a query that takes so much time. it contains the billing period as date YYYYMM)


      I would like to pass a parameter in the query it self so it only brings the data of the selected period by the user


      How I proceed?


      Thanks a lot.

        • 1. Re: Query optimisation
          Rahul Verma

          Hey Wiem


          As far as i get your problem, you want a particular set of data only to bring in Tableau so as to Optimise the Query. Whatever database you're using, doesn't matter! You can "Add Filter" while importing the data at very initial stage which helps you to minimize the amount of data and only relevant data comes in! As an example, I am adding a screenshot where I am importing Superstore data and there itself I am filtering the data based on Countries; I am only taking India as a country for my purpose.


          I hope this will help you


          Let me know





          4 of 4 people found this helpful
          • 2. Re: Query optimisation
            wiem bekir

            Hi Rahul,


            I think I didn't explain my problem properly. Excuse my bad english. So my problem is that I am using a query that takes too much time to be executed because I need to get records since 2003. My date field has this format yyyymm.  I added a parameter in my query like this :


            "date_trunc ('month',to_date(a.billing_period::text, 'yyyymm'::text),'YYYY/MM/DD'))= date_trunc ('month',<Paramètres.Param>)"


            and I added the same parameter as a filter :


            so every time a user select a date from the paramter filter, only the query of that date will be executed.


            But my problem with this method, only one period will be displayed according to the user selection. I need to make possible for users to select more then one period at a time?? is there any way to do it?


            Thank you