Re: [PERFORM] The usual sequential scan, but with LIMIT !

2004-09-07 Thread Gaetano Mendola
Pierre-Frédéric Caillaud wrote:
Yes, you're right as usual.
As usual ? Do you think your father can be wrong on you ? :-)

Gaetano



---(end of broadcast)---
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]


Re: [PERFORM] The usual sequential scan, but with LIMIT !

2004-09-07 Thread Pierre-Frédéric Caillaud
	Yes, you're right as usual.
	I had not thought about playing with ORDER BY on a field which has only  
one value in the result set.


If you write it as
SELECT WHERE topic_id=2 ORDER BY topic_id DESC,id DESC.
then an index on (topic_id, id) will work fine.  The mixed ASC/DESC
ordering is not compatible with the index.

---(end of broadcast)---
TIP 6: Have you searched our list archives?
  http://archives.postgresql.org


Re: [PERFORM] [ADMIN] TOAST tables, cannot truncate

2004-09-07 Thread Tom Lane
G u i d o B a r o s i o <[EMAIL PROTECTED]> writes:
> Ok, problem solved.
> A previous ALTER TABLE DROP COLUMN over this table was performed.
> By some reason, truncate didn't work then. Would like to know why...it does not 
> seems to be a very frequent problem, due to the fact I only found one chat on the 
> mailing lists talking about this issue, and was hard to find :( !

http://developer.postgresql.org/cvsweb.cgi/pgsql-server/src/backend/commands/cluster.c

(note: cvsweb seems mighty slow today, but it is working...)

regards, tom lane

---(end of broadcast)---
TIP 3: if posting/reading through Usenet, please send an appropriate
  subscribe-nomail command to [EMAIL PROTECTED] so that your
  message can get through to the mailing list cleanly


Re: [PERFORM] The usual sequential scan, but with LIMIT !

2004-09-07 Thread Tom Lane
=?iso-8859-15?Q?Pierre-Fr=E9d=E9ric_Caillaud?= <[EMAIL PROTECTED]> writes:
>   suppose I SELECT WHERE topic_id=2 ORDER BY topic_id ASC,id DESC.
>   Postgres does a seq scan, but it could think a bit more and start at  
> "first index node which has topic_id>2" (simple to find in a btree) then  
> go backwards in the index.

If you write it as
SELECT WHERE topic_id=2 ORDER BY topic_id DESC,id DESC.
then an index on (topic_id, id) will work fine.  The mixed ASC/DESC
ordering is not compatible with the index.

regards, tom lane

---(end of broadcast)---
TIP 5: Have you checked our extensive FAQ?

   http://www.postgresql.org/docs/faqs/FAQ.html


Re: [PERFORM] [ADMIN] TOAST tables, cannot truncate

2004-09-07 Thread G u i d o B a r o s i o
Ok, problem solved.

A previous ALTER TABLE DROP COLUMN over this table was performed.
By some reason, truncate didn't work then. Would like to know why...it does not seems 
to be a very frequent problem, due to the fact I only found one chat on the mailing 
lists talking about this issue, and was hard to find :( !

A dump of the table schema, passed to the psql command 
(cat table_dump.sql | psql xxx) worked fine.

TRUNCATE is now available.

Thanks.

Guido

> Sorry for crossposting, didn't know where to post.
> 
> Any hint/help on this?!
> 
> db_postgres1=# truncate ref_v2_drs_valid_product ;
> ERROR:  expected both swapped tables to have TOAST tables
> 
> I need to truncate this table, this is the first time I see this error.
> 
> Regards,
> Guido
> 
> 
> ---(end of broadcast)---
> TIP 8: explain analyze is your friend


---(end of broadcast)---
TIP 7: don't forget to increase your free space map settings


[PERFORM] TOAST tables, cannot truncate

2004-09-07 Thread G u i d o B a r o s i o
Sorry for crossposting, didn't know where to post.

Any hint/help on this?!

db_postgres1=# truncate ref_v2_drs_valid_product ;
ERROR:  expected both swapped tables to have TOAST tables

I need to truncate this table, this is the first time I see this error.

Regards,
Guido


---(end of broadcast)---
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])