Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a query that gives the total number of rows to use in a pagination:

    select count(1) as total_rows from 
 (subquery with some sum() and 2 inner joins) as as total_sums ;
  1. when I run only the subquery it takes 15s

  2. when I run the count against the subquery it takes 50 secs.

I am wondering to know if Vertica offers a better way to get the total of rows from an aggregation query.

share|improve this question
Sometimes a few line of code says more than a chapter in a book, or how it goes. Could you show the query? – dezso Sep 12 '13 at 20:17
Besides posting the code, run "explain <query>;" and post the results. – geoffrobinson Sep 13 '13 at 12:38
Post query and your explain output ! This will be a good start – Up_One May 8 '15 at 13:53

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.