Re: [SQL] Returning the total number of rows as a separate column when using limit

2007-11-05 Thread Gregory Stark
"Gregory Stark" <[EMAIL PROTECTED]> writes: > "Andreas Joseph Krogh" <[EMAIL PROTECTED]> writes: > >> That's what I'm doing now. I run the query with "limit+1" as limit and if it >> results in more than limit, I know there is more data and I run count(*) to >> count them all. But count(*) cannot

Re: [SQL] Returning the total number of rows as a separate column when using limit

2007-11-05 Thread Gregory Stark
"Andreas Joseph Krogh" <[EMAIL PROTECTED]> writes: > That's what I'm doing now. I run the query with "limit+1" as limit and if it > results in more than limit, I know there is more data and I run count(*) to > count them all. But count(*) cannot use indices in PG so it's limited in > speed any

Re: [SQL] Returning the total number of rows as a separate column when using limit

2007-11-05 Thread Andreas Joseph Krogh
On Monday 05 November 2007 16:27:03 Gregory Stark wrote: > > Andreas Joseph Krogh <[EMAIL PROTECTED]> writes: > >> On Monday 05 November 2007 15:18:22 Tom Lane wrote: > >>> That's only an estimate. Since the query doesn't get executed to > >>> completion thanks to the LIMIT, Postgres really has no

Re: [SQL] Returning the total number of rows as a separate column when using limit

2007-11-05 Thread Gregory Stark
> Andreas Joseph Krogh <[EMAIL PROTECTED]> writes: >> On Monday 05 November 2007 15:18:22 Tom Lane wrote: >>> That's only an estimate. Since the query doesn't get executed to >>> completion thanks to the LIMIT, Postgres really has no idea whether >>> the estimate is accurate. > >> Ok. The query i

Re: [SQL] Returning the total number of rows as a separate column when using limit

2007-11-05 Thread Tom Lane
Andreas Joseph Krogh <[EMAIL PROTECTED]> writes: > On Monday 05 November 2007 15:18:22 Tom Lane wrote: >> That's only an estimate. Since the query doesn't get executed to >> completion thanks to the LIMIT, Postgres really has no idea whether >> the estimate is accurate. > Ok. The query is ORDER-e

Re: [SQL] Returning the total number of rows as a separate column when using limit

2007-11-05 Thread Andreas Joseph Krogh
On Monday 05 November 2007 15:18:22 Tom Lane wrote: > Andreas Joseph Krogh <[EMAIL PROTECTED]> writes: > > AFAICS the information about the *total* number of rows is in the > > "result" somehow. When I execute a "limit 1" query with EXPLAIN ANALYZE, > > I se the total number of columns in "rows=200

Re: [SQL] Returning the total number of rows as a separate column when using limit

2007-11-05 Thread Tom Lane
Andreas Joseph Krogh <[EMAIL PROTECTED]> writes: > AFAICS the information about the *total* number of rows is in the "result" > somehow. When I execute a "limit 1" query with EXPLAIN ANALYZE, I se the > total number of columns in "rows=200819", so the information is there. That's only an estimat

[SQL] Returning the total number of rows as a separate column when using limit

2007-11-04 Thread Andreas Joseph Krogh
This is a re-post as I didn't get any response last time Hi. AFAICS the information about the *total* number of rows is in the "result" somehow. When I execute a "limit 1" query with EXPLAIN ANALYZE, I se the total number of columns in "ro

[SQL] Returning the total number of rows as a separate column when using limit

2007-10-31 Thread Andreas Joseph Krogh
Hi. AFAICS the information about the *total* number of rows is in the "result" somehow. When I execute a "limit 1" query with EXPLAIN ANALYZE, I se the total number of columns in "rows=200819", so the information is there. andreak=# EXPLAIN ANALYZE select p.id from onp_crm_person p order by p.c