COUNT

From: "Lufkin, Brad" <brad(dot)lufkin(at)ngc(dot)com>
To: 'psql' <pgsql-jdbc(at)postgresql(dot)org>
Subject: COUNT
Date: 2003-09-03 14:25:11
Message-ID: 0E253E40DC78F4499CEDDE9223099F430706B831@xcgva040.northgrum.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

I'm trying to determine the number of rows in a table with the following
statement:

ResultSet resultSet = statement.executeQuery("SELECT COUNT(*) FROM
table");

This is apparently causing a sequential scan of the table (which has several
million rows). Is there a faster way of determining the number of rows in a
table?

Browse pgsql-jdbc by date

  From Date Subject
Next Message Barry Lind 2003-09-03 15:38:15 Re: Writing binary - UPDATE
Previous Message Andreas Buer 2003-09-03 13:04:36 Writing binary - UPDATE