Re: [GENERAL] Index problem

2005-06-13 Thread Bruno Wolff III
On Tue, Jun 14, 2005 at 08:37:38 +1200, David Mitchell <[EMAIL PROTECTED]> wrote: > I'm totally baffled as to why postgres won't use this index. I have a > table "point" with an index on it as so: > > CREATE INDEX unit_point > ON point > USING btree > (unit_id, time); > > When I try the

[GENERAL] Index problem

2005-06-13 Thread David Mitchell
I'm totally baffled as to why postgres won't use this index. I have a table "point" with an index on it as so: CREATE INDEX unit_point ON point USING btree (unit_id, time); When I try the following query, it insists on using a seqscan: SELECT time FROM point WHERE unit_id = 95501 and fla

Re: [GENERAL] Index problem.... GIST (tsearch2)

2004-10-07 Thread Net Virtual Mailing Lists
Thanks, you are right, I mis-typed the statements (lack of sleep *shrug*), thanks for parsing through it... Your suggestion did resolve the situation nicely! - Greg >"Net Virtual Mailing Lists" <[EMAIL PROTECTED]> writes: >> I have a table like this with some indexes as identified: > >> CREATE O

Re: [GENERAL] Index problem.... GIST (tsearch2)

2004-10-07 Thread Tom Lane
"Net Virtual Mailing Lists" <[EMAIL PROTECTED]> writes: > I have a table like this with some indexes as identified: > CREATE OR REPLACE FUNCTION is_null(anyelement) RETURNS BOOLEAN AS 'SELECT > $1 IS NULL;' LANGUAGE 'SQL' IMMUTABLE; > CREATE FUNCTION sometable_category1_idx ON sometable (category1

Re: [GENERAL] Index problem.... GIST (tsearch2)

2004-10-07 Thread Tom Lane
Greg Stark <[EMAIL PROTECTED]> writes: > 8.0 will have statistics on how often is_null() will return false. But that > isn't really going to solve your problem since it still won't have any idea > how many rows the full text search will find. > I don't even know of anything you can do to influence

Re: [GENERAL] Index problem.... GIST (tsearch2)

2004-10-07 Thread Greg Stark
"Net Virtual Mailing Lists" <[EMAIL PROTECTED]>(by way of Net Virtual Mailing Lists <[EMAIL PROTECTED]>) writes: > >SELECT * from sometable WHERE category1 IS NOT NULL > > AND data_fti @@ to_tsquery('default', 'postgres'); What you can do is a partial index: create index fulltextindex on some

Re: [GENERAL] Index problem.... GIST (tsearch2)

2004-10-07 Thread Greg Stark
"Net Virtual Mailing Lists" <[EMAIL PROTECTED]> writes: > SELECT * from sometable WHERE is_null(category1)='f' AND data_fti @@ > to_tsquery('default', 'postgres'); > > How can I make this query first use the is_null index?... It strikes me > that this would almost always be faster then doing the

Re: [GENERAL] Index problem.... GIST (tsearch2)

2004-10-07 Thread Net Virtual Mailing Lists
Than you very much Andrew... Yes you are right.. I mis-typeed CREATE INDEX.. ;-) The actual create indexes are as you suggested: CREATE INDEX sometable_category1_idx ON sometable (is_null(category1)); CREATE INDEX sometable_category2_idx ON sometable (is_null(category2)); CREATE INDEX sometable_

[GENERAL] Index problem.... GIST (tsearch2)

2004-10-07 Thread Net Virtual Mailing Lists
Hello, I have a table like this with some indexes as identified: CREATE TABLE sometable ( dataTEXT, data_ftiTSVECTOR, category1 INTEGER, category2 INTEGER, category3 INTEGER ); CREATE OR REPLACE FUNCTION is_null(anyelement) RETURNS BOOLEAN AS 'SELECT $1 IS

Re: [GENERAL] index problem

2000-06-07 Thread Tom Lane
Lincoln Yeoh <[EMAIL PROTECTED]> writes: > At 10:53 AM 05-06-2000 +0200, Marcin Inkielman wrote: >> drop index oceny_stud_numer_albumu_protokoloceny_stud; >> failed >> so I used: >> drop index "oceny_stud_numer_albumu_protokoloceny_stud"; >> and it worked for me 8-))) > I wonder why it worked

Re: [GENERAL] index problem

2000-06-06 Thread Lincoln Yeoh
At 10:53 AM 05-06-2000 +0200, Marcin Inkielman wrote: >On Mon, 5 Jun 2000, Lincoln Yeoh wrote: >I solved my problem simplier: > >drop index oceny_stud_numer_albumu_protokol_id; > >and > >drop index oceny_stud_numer_albumu_protokoloceny_stud; > >failed > > >so I used: > >drop index "oceny_st

Re: [GENERAL] index problem

2000-06-01 Thread Tom Lane
Marcin Inkielman <[EMAIL PROTECTED]> writes: > I created an index using pgaccess rescently. the name of the index was > long: > "oceny_stud_numer_albumu_protokoloceny_stud" > now i am unable to vacuum my database. Oh dear :-( ... it seems that when you quote an identifier, the system forgets to m

[GENERAL] index problem

2000-06-01 Thread Marcin Inkielman
hi! I created an index using pgaccess rescently. the name of the index was long: "oceny_stud_numer_albumu_protokoloceny_stud" now i am unable to vacuum my database. i obtain something like this when i try: NOTICE: Pages 310: Changed 0, reaped 2, Empty 0, New 0; Tup 48611: Vac 3, Keep/VTL 0/