title: How to get distinct rows faster from a huge table?
body: <p>I have a huge table which contains about 250 million rows. I have only SELECT privilege to this table. My intention is to query distinct records from a specific columns. I'm using a query</p>
  
  <pre><code>select var1, count(*)
  from hr.hugetable
  group by var1
  </code></pre>
  
  <p>This query takes about 15 minutes to complete. There is no index on var1 and I'm not able to add it. Is there a way to refine this query to fetch results faster? This query would also do it (I do not need count the record, only distinct values), but I think it is not faster. </p>
  
  <pre><code>select distinct Var1
  from hr.hugetable
  </code></pre>