pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Tony Capobianco <tcapobianco@prospectiv.com>
Cc: Pavel Stehule <pavel.stehule@gmail.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Cursor fetch performance issue
Date: Tue, 24 Jan 2012 16:28:17 -0500
Message-ID: <7727.1327440497@sss.pgh.pa.us> (raw)
In-Reply-To: <1327438657.1968.15.camel@tony1.localdomain>
References: <1327437700.1968.10.camel@tony1.localdomain>
	<CAFj8pRD3g3WESOxES27t_pBh_30Ko7JO7nKCf77oRsjU==tFwQ@mail.gmail.com>
	<1327438657.1968.15.camel@tony1.localdomain>

Tony Capobianco <tcapobianco@prospectiv.com> writes:
> Running just the sql of the function returns only 10 rows:
> pg=# SELECT m.memberid, m.websiteid, m.emailaddress, 
> pg-#                m.firstname, m.lastname, m.regcomplete, m.emailok
> pg-#         FROM   members m
> pg-#         WHERE  m.emailaddress LIKE 'test.email@hotmail.com'
> pg-#         AND    m.changedate_id < 5868 ORDER BY m.emailaddress, m.websiteid;

Based on that, I'd bet your problem is that the function is executing
	WHERE  m.emailaddress LIKE $1
(for some spelling of $1) and you are therefore not getting the benefit
of the index optimizations that can happen when LIKE's pattern is
constant.  Do you actually need LIKE rather than just "=" here?

			regards, tom lane



view thread (9+ messages)  latest in thread

Message-ID: <7727.1327440497@sss.pgh.pa.us>
Permalink:  ../7727.1327440497@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/7727.1327440497@sss.pgh.pa.us

 · 

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: tgl@sss.pgh.pa.us, tcapobianco@prospectiv.com, pavel.stehule@gmail.com
  Subject: Re: Cursor fetch performance issue
  In-Reply-To: <7727.1327440497@sss.pgh.pa.us>

* 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