Received: from localhost.localdomain (postgresql.org [64.49.215.8]) by localhost (Postfix) with ESMTP id C2B96475862 for ; Mon, 20 May 2002 07:15:37 -0400 (EDT) Received: from digma.kharkov.ua (digma.kharkov.ua [217.12.194.76]) by postgresql.org (Postfix) with SMTP id 9D969475873 for ; Mon, 20 May 2002 07:15:26 -0400 (EDT) Received: (qmail 21930 invoked from network); 20 May 2002 11:14:02 -0000 Received: from demani.digma (HELO digma.kharkov.ua) (cub@172.20.5.7) by ns.digma with SMTP; 20 May 2002 11:14:02 -0000 Message-ID: <3CE8DAC9.5040502@digma.kharkov.ua> Date: Mon, 20 May 2002 14:15:21 +0300 From: Kostyuk Oleg User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:0.9.9) Gecko/20020509 X-Accept-Language: ru, en-us, en MIME-Version: 1.0 To: pgsql-general@postgresql.org Subject: Bug or feature? Content-Type: text/plain; charset=KOI8-R; format=flowed Content-Transfer-Encoding: 7bit X-Archive-Number: 200205/705 X-Sequence-Number: 24685 pgSQL 7.2.1, table with ~590000 rows with next stuct: user_id integer url text .................... -- other fields i do VACUUM ANALYZE, and then have this results: 1) ---------- proxy=> EXPLAIN SELECT count(user_id) AS cnt, user_id FROM stats GROUP BY user_id ORDER BY cnt DESC; NOTICE: QUERY PLAN: Sort (cost=94399.52..94399.52 rows=58842 width=4) -> Aggregate (cost=86383.49..89325.61 rows=58842 width=4) -> Group (cost=86383.49..87854.55 rows=588425 width=4) -> Sort (cost=86383.49..86383.49 rows=588425 width=4) -> Seq Scan on stats (cost=0.00..13873.25 rows=588425 width=4) 2) ---------- proxy=> EXPLAIN SELECT count(url) AS cnt, user_id FROM stats GROUP BY user_id ORDER BY cnt DESC; NOTICE: QUERY PLAN: Sort (cost=155022.05..155022.05 rows=58842 width=51) -> Aggregate (cost=146163.49..149105.61 rows=58842 width=51) -> Group (cost=146163.49..147634.55 rows=588425 width=51) -> Sort (cost=146163.49..146163.49 rows=588425 width=51) -> Seq Scan on stats (cost=0.00..13873.25 rows=588425 width=51) -----------end----------- cost grow by 1.5 times! yes, i understand - this because url column have big width... but in count(url) width of column not important! - but used?... or it's bug of optimizer? or it's not implemented in optimizer? Thx. ps : sorry for my bad english :) -- With best wishes, DIGMA sysadmin Oleg Kostyuk aka Cub (CUB7-RIPE) [BSD registered user #BSD050664]