4 Replies Latest reply on Jan 22, 2018 5:00 PM by Anibal Muñoz Casco

    Dynamic "WHERE" for every query

    Anibal Muñoz Casco Newbie

      Hello,

       

      I'm new around here and using teiid so I hope is the correct place to ask this.

      I'm using:

      • Teiid 9.0.6 with Wildfly (Which I guess is WildFly 9.0.2)
      • Red Hat JBoss Developer Studio 11.0.0 GA
      • Teiid Designer 11.1.0
      • Windows 2012 R2

       

      I have a project where I'm making a VDB with 5 tables, each one getting information from several tables from 2 diferent sources (MSSQL/PostgreSQL).

       

      Now my main problem is that the server I have (and can't replace) has 8 cores and 16GB RAM that Teiid can use, and this seems not be enough for all the data I'm querying, most of my view's queries are like:

      SELECT name, lastname FROM Source1.Table1
      UNION
      SELECT name, lastname FROM Source1.Table2
      ...

       

      I can't use limit because that just "cuts" the data and somehow makes Teiid incredible slow to answer so what I'm guessing and asking how can I make the queries I'm using in the views "dynamics" so I can turn the above query in something like:

      SELECT name, lastname FROM Source1.Table1 WHERE name = 'Variable'
      UNION
      SELECT name, lastname FROM Source1.Table2 WHERE name = 'Variable'
      ...

       

      In where "Variable" is a value I send from the query I make to the VDB, so then if I query the VDB with

      SELECT * FROM Persons WHERE name = 'Anibal'

       

      I get the queries in the views turn:

      SELECT name, lastname FROM Source1.Table1 WHERE name = 'Anibal'
      UNION
      SELECT name, lastname FROM Source1.Table2 WHERE name = 'Anibal'
      ...

       

      And then return the data, is that even possible? How can I achive this?

       

      Thank you.