pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Pierre C <lists@peufeu.com>
To: pgsql-performance@postgresql.org <pgsql-performance@postgresql.org>
To: Neil Whelchel <neil.whelchel@gmail.com>
Subject: Re: Slow count(*) again...
Date: Tue, 12 Oct 2010 23:35:01 +0200
Message-ID: <op.vkhfkn1yeorkce@apollo13> (raw)
In-Reply-To: <201010111936.46207.neil.whelchel@gmail.com>
References: <201010091626.18636.neil.whelchel@gmail.com>
	<201010111254.58479.neil.whelchel@gmail.com>
	<4CB3A2CC.9070009@vmsinfo.com>
	<201010111936.46207.neil.whelchel@gmail.com>


> suggest that 99% instances of the "select count(*)" idiom are probably
>> bad use of the SQL language.

Well, suppose you paginate results. If the user sees that the search query  
returns 500 pages, there are two options :

- you're google, and your sorting algorithms are so good that the answer  
the user wants is in the first page
- or the user will refine his search by entering more keywords tu get a  
manageable result set

So, in both cases, the count(*) was useless anyway. And the slowest ones  
are the most useless, since the user will immediatey discard the result  
and refine his query.

If your full text search is slow, try Xapian or Lucene.



view thread (246+ messages)  latest in thread

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

 · 

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-performance@postgresql.org
  Cc: lists@peufeu.com, neil.whelchel@gmail.com
  Subject: Re: Slow count(*) again...
  In-Reply-To: <op.vkhfkn1yeorkce@apollo13>

* 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