pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: PFC <lists@boutiquenumerique.com>
To: Joel Fradkin <jfradkin@wazagua.com>
To: 'Tom Lane' <tgl@sss.pgh.pa.us>
To: 'Bob Henkel' <luckyratfoot@gmail.com>
Cc: 'Scott Marlowe' <smarlowe@g2switchworks.com>
Cc: 'Andrew Sullivan' <ajs@crankycanuck.ca>
Cc: pgsql-sql@postgresql.org
Subject: Re: getting count for a specific querry
Date: Fri, 08 Apr 2005 23:37:55 +0200
Message-ID: <op.soxnphy2th1vuj@localhost> (raw)
In-Reply-To: <004b01c53c72$5e4c6390$797ba8c0@jfradkin>
References: <004b01c53c72$5e4c6390$797ba8c0@jfradkin>


> Since it is a count of matched condition records I may not have a way
> around.

	What you could do is cache the search results (just caching the id's of  
the rows to display is enough and uses little space) in a cache table,  
numbering them with your sort order using a temporary sequence, so that  
you can :
	SELECT ... FROM cache WHERE row_position BETWEEN page_no*per_page AND  
(page_no+1)*per_page-1
	to get the count :
	SELECT row_position FROM CACHE ORDER BY row_position DESC LIMIT 1

	Add a session_id referencing your sessions table with an ON DELETE  
CASCADE and the cache will be auto-purged when sessions expire.



view thread (38+ messages)  latest in thread

Message-ID: <op.soxnphy2th1vuj@localhost>
Permalink:  ../op.soxnphy2th1vuj@localhost/
Also on:    postgresql.org/message-id/op.soxnphy2th1vuj@localhost

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: lists@boutiquenumerique.com, jfradkin@wazagua.com, tgl@sss.pgh.pa.us, luckyratfoot@gmail.com, smarlowe@g2switchworks.com, ajs@crankycanuck.ca
  Subject: Re: getting count for a specific querry
  In-Reply-To: <op.soxnphy2th1vuj@localhost>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox