title: Increasing performance in connection to Teradata
body: <p>I need to connect to Teradata using Python. The problem I am facing is the long time to connect to database.</p>
  <p>I am trying with <code>teradata</code>, <code>teradatasql</code> and <code>pyodbc</code> packages in Python. The code I am using is something like:</p>
  <pre><code>import teradata
  import teradatasql
  import pyodbc
  import time
  
  udaExec = teradata.UdaExec (appName=&quot;HelloWorld&quot;, version=&quot;1.0&quot;, logConsole=False)
  
  try:
    host, username, password = 'teradata', 'xxxxx', 'xxxxx'
    tic = time.perf_counter()
    session = teradatasql.connect(host=host, user=username, password=password, logmech=&quot;LDAP&quot;)
    toc = time.perf_counter()
    print(f&quot;TERADATASQL:  {toc - tic:0.4f} seconds&quot;)
  
    tic = time.perf_counter()
    udaExec.connect(method=&quot;odbc&quot;, dsn=&quot;TD&quot;)
    toc = time.perf_counter()
    print(f&quot;TERADATA:  {toc - tic:0.4f} seconds&quot;)
  
    tic = time.perf_counter()
    connection = pyodbc.connect('DSN=TD')
    toc = time.perf_counter()
    print(f&quot;PYODBC:  {toc - tic:0.4f} seconds&quot;)
  
  except Exception as e:
    print(e)
  </code></pre>
  <p>The usual result is something around the following values:</p>
  <blockquote>
  <p>TERADATASQL:  6.2150 seconds</p>
  </blockquote>
  <blockquote>
  <p>TERADATA:  2.8512 seconds</p>
  </blockquote>
  <blockquote>
  <p>PYODBC:  2.6051 seconds</p>
  </blockquote>
  <p>The problem is that most part of time I´ll make very simple queries that costs much less than 1 second.</p>
  <p>I developed (by myself) a scheme using a pool of 5 pre opened connections. But I think this is very rudimentar, since it is a django serving a REST API service with multiple users. Are there any way to increase the performance to open connections? Any other solutions?</p>