Received: from localhost (unknown [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id 672392E36B4 for ; Sun, 13 Jan 2008 22:58:47 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 70806-01 for ; Sun, 13 Jan 2008 22:58:35 -0400 (AST) Received: from an-out-0708.google.com (an-out-0708.google.com [209.85.132.250]) by postgresql.org (Postfix) with ESMTP id 83BF22E359B for ; Sun, 13 Jan 2008 22:58:42 -0400 (AST) Received: by an-out-0708.google.com with SMTP id c36so435560ana.33 for ; Sun, 13 Jan 2008 18:58:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:mime-version:content-type; bh=juuU7WRrA865IKHKYTmPTzjoaniHzuMY44tjT+xqsKg=; b=uynTGlzXzqECD7LmhTc6sPGnVh/1m9EdlLjWh/YDUnfpSuJPdi/z2gqxIf4h/DhIVME5EefqNZTfsBaWbj+5tGPgjAVR7jaPcbMH357ck1jIrg1uCO5qgIKdGtztMsVvFiMuqDfsnp2n/BK7B1KUU7TiG/qliQqIlYcjDkI0/jY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:mime-version:content-type; b=QJQG4A+vjHydz9kDI/QT3PRwCM/HUqY7zZCsqq5RQdL63DXEsj9BhPflsQB85sk9raXBSu4wOsWdkACKP6DZ/7K7P6JxAsCTXTA2r8bgqr/mGkTegVR6wgowloPeyndkKbdW8wqn1G1bWjlJKuXwh/P96/hAg4zE3hkXIrhngJQ= Received: by 10.100.8.10 with SMTP id 10mr12958298anh.59.1200279521199; Sun, 13 Jan 2008 18:58:41 -0800 (PST) Received: by 10.100.93.16 with HTTP; Sun, 13 Jan 2008 18:58:41 -0800 (PST) Message-ID: <198501d60801131858n529b46dcmeb286cda32d56e93@mail.gmail.com> Date: Mon, 14 Jan 2008 03:58:41 +0100 From: pepone.onrez To: pgsql-general@postgresql.org Subject: query performance MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_8470_31164541.1200279521196" X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200801/620 X-Sequence-Number: 126828 ------=_Part_8470_31164541.1200279521196 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline I have this query in a table with 150 thowsand tuples and it takes to long t_documentcontent._id AS _id FROM t_documentcontent LIMIT 50 OFFSET 80000 here is the explain output "Limit (cost=100058762.30..100058799.02 rows=50 width=58) (actual time= 19433.474..19433.680 rows=50 loops=1)" " -> Seq Scan on t_documentcontent (cost=100000000.00..100110772.07rows=150807 width=58) (actual time= 53.934..19402.030 rows=80050 loops=1)" "Total runtime: 19433.748 ms" here the table structure CREATE TABLE t_documentcontent( _id varchar(60) NOT NULL, _filesystem varchar(60) NOT NULL, _parent varchar(60) NOT NULL, _document varchar(60) NOT NULL, _title varchar NOT NULL, _resume varchar, _content varchar, _lang integer NOT NULL, _creationdate timestamp NOT NULL DEFAULT now(), _updatedate timestamp NOT NULL DEFAULT now(), _indexeddate timestamp NOT NULL DEFAULT now(), CONSTRAINT documentcontent_pkey PRIMARY KEY (_id), CONSTRAINT documentcontent_filesystem_fkey FOREIGN KEY (_filesystem) REFERENCES t_filesystem(_id) ON UPDATE CASCADE ON DELETE NO ACTION, CONSTRAINT documentcontent_parent_fkey FOREIGN KEY (_parent) REFERENCES t_node(_id) ON DELETE NO ACTION, CONSTRAINT documentcontent_document_fkey FOREIGN KEY (_document) REFERENCES t_node(_id) ON UPDATE CASCADE ON DELETE NO ACTION, CONSTRAINT documentcontent_lang_lang_fkey FOREIGN KEY (_lang) REFERENCES t_lang(_id)) WITHOUT OIDS; Any ideas for improve this query performance. ------=_Part_8470_31164541.1200279521196 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline I have this query in a table with 150 thowsand tuples and it takes to long

    t_documentcontent._id AS _id
    FROM t_documentcontent LIMIT 50 OFFSET 80000

here is the explain output

"Limit  (cost= 100058762.30..100058799.02 rows=50 width=58) (actual time=19433.474..19433.680 rows=50 loops=1)"
"  ->  Seq Scan on t_documentcontent  (cost=100000000.00..100110772.07 rows=150807 width=58) (actual time=53.934..19402.030 rows=80050 loops=1)"
"Total runtime: 19433.748 ms"

here the table structure

CREATE TABLE t_documentcontent(
    _id varchar(60) NOT NULL,
    _filesystem varchar(60) NOT NULL,
    _parent varchar(60) NOT NULL,
    _document varchar(60) NOT NULL,
    _title varchar NOT NULL,
    _resume varchar,
    _content varchar,
    _lang integer NOT NULL,
    _creationdate timestamp NOT NULL DEFAULT now(),
    _updatedate timestamp NOT NULL DEFAULT now(),
    _indexeddate timestamp NOT NULL DEFAULT now(),
    CONSTRAINT documentcontent_pkey PRIMARY KEY (_id),
    CONSTRAINT documentcontent_filesystem_fkey
        FOREIGN KEY (_filesystem) REFERENCES t_filesystem(_id) ON UPDATE CASCADE ON DELETE NO ACTION,
    CONSTRAINT documentcontent_parent_fkey FOREIGN KEY (_parent) REFERENCES t_node(_id) ON DELETE NO ACTION,
    CONSTRAINT documentcontent_document_fkey
        FOREIGN KEY (_document) REFERENCES t_node(_id) ON UPDATE CASCADE ON DELETE NO ACTION,
    CONSTRAINT documentcontent_lang_lang_fkey FOREIGN KEY (_lang) REFERENCES t_lang(_id)) WITHOUT OIDS;

Any ideas for improve this query performance.
------=_Part_8470_31164541.1200279521196--