Re: [SQL] Index Usage and Running Times by FullTextSearch with prefix matching

2013-06-13 Thread Tom Lane
rawi writes: > And querying: FTS with prefix matching: > SELECT count(a) > FROM t1 > WHERE a_tsvector @@ to_tsquery('aaa:* & b:* & c:* & d:*') > (RESULT: count: 619) > Total query runtime: 21266 ms. FWIW, I get fairly decent performance for cases like this in HEAD (at least with a GIN index; GI

[SQL] Index Usage and Running Times by FullTextSearch with prefix matching

2013-06-13 Thread rawi
Hi I tested the following: CREATE TABLE t1 ( id serial NOT NULL, a character varying(125), a_tsvector tsvector, CONSTRAINT t1_pkey PRIMARY KEY (id) ); INSERT INTO t1 (a, a_tsvector) VALUES ('o,p,f,j,z,j', to_tsvector('o,p,f,j,z,j'); CREAT

Re: [SQL] Index usage in bitwise operation context

2007-09-13 Thread Gregory Stark
"W.Alphonse HAROUNY" <[EMAIL PROTECTED]> writes: > Question: > -- > I have an SQL request similar to: > > SELECT . FROM TBL1, TBL2 WHERE > AND > TBL1.CATEGORY & TBL2.CATEGORY <> 0 //-- where & is the AND bitwise > operator > > Qst: > 1/ IS the above SQL request will use the IND

[SQL] Index usage in bitwise operation context

2007-09-13 Thread W.Alphonse HAROUNY
Hello, My question is about index usage when bitwise operations are invoked. Situation Context: -- Lets suppose we have 2 tables TBL1 and TBL2 as the following: TBL1 { . ; integer categoryGroup; // categoryGroup is declared as an index on TABL1 . ; }

Re: [SQL] Index usage in order by with multiple columns in order-by-clause

2007-08-11 Thread Andreas Joseph Krogh
On Saturday 11 August 2007 21:55:49 Tom Lane wrote: > Andreas Joseph Krogh <[EMAIL PROTECTED]> writes: > > On Friday 10 August 2007 23:30:14 Tom Lane wrote: > >> Reverse-sorted index columns are possible but not well supported in > >> existing PG releases (you need a custom operator class, and the

Re: [SQL] Index usage in order by with multiple columns in order-by-clause

2007-08-11 Thread Tom Lane
Andreas Joseph Krogh <[EMAIL PROTECTED]> writes: > On Friday 10 August 2007 23:30:14 Tom Lane wrote: >> Reverse-sorted index columns are possible but not well supported in >> existing PG releases (you need a custom operator class, and the planner >> is not all that bright about using them). 8.3 wi

Re: [SQL] Index usage in order by with multiple columns in order-by-clause

2007-08-11 Thread Andreas Joseph Krogh
On Saturday 11 August 2007 21:05:22 hubert depesz lubaczewski wrote: > On Fri, Aug 10, 2007 at 04:53:12PM +0200, Andreas Joseph Krogh wrote: > > I have the following test-case: > > > > CREATE TABLE test( > > name varchar PRIMARY KEY, > > value varchar NOT NULL, > > created timestamp not null > > );

Re: [SQL] Index usage in order by with multiple columns in order-by-clause

2007-08-11 Thread hubert depesz lubaczewski
On Fri, Aug 10, 2007 at 04:53:12PM +0200, Andreas Joseph Krogh wrote: > I have the following test-case: > > CREATE TABLE test( > name varchar PRIMARY KEY, > value varchar NOT NULL, > created timestamp not null > ); > > create index test_lowernamevalue_idx ON test ((lower(name) || lower(value)));

Re: [SQL] Index usage in order by with multiple columns in order-by-clause

2007-08-11 Thread Andreas Joseph Krogh
On Friday 10 August 2007 23:30:14 Tom Lane wrote: > Andreas Joseph Krogh <[EMAIL PROTECTED]> writes: > > Is there a way I can have multiple columns in the ORDER BY clause, each > > with different ASC/DESC-order and still use an index to speed up sorting? > > A btree index isn't magic, it's just an

Re: [SQL] Index usage in order by with multiple columns in order-by-clause

2007-08-10 Thread Tom Lane
Andreas Joseph Krogh <[EMAIL PROTECTED]> writes: > Is there a way I can have multiple columns in the ORDER BY clause, each with > different ASC/DESC-order and still use an index to speed up sorting? A btree index isn't magic, it's just an ordered list of entries. So you can't just randomly flip t

[SQL] Index usage in order by with multiple columns in order-by-clause

2007-08-10 Thread Andreas Joseph Krogh
I have the following test-case: CREATE TABLE test( name varchar PRIMARY KEY, value varchar NOT NULL, created timestamp not null ); create index test_lowernamevalue_idx ON test ((lower(name) || lower(value))); create index test_lowernamevaluecreated_idx ON test ((lower(name) || lower(value)), cre

Re: [SQL] index usage for query

2002-11-19 Thread Richard Huxton
On Tuesday 19 Nov 2002 9:10 am, Tomas Berndtsson wrote: > Hi, > > I have a question about index usage in PostgreSQL 7.2.1 on Solaris. > > At first, I did the query like this: > > SELECT po.portno,po.element,s.sname,pri,p.pname,value > FROM port po, port_s s LEFT OUTER JOIN port_s_p p > USING (elem

[SQL] index usage for query

2002-11-19 Thread Tomas Berndtsson
Hi, I have a question about index usage in PostgreSQL 7.2.1 on Solaris. I have three tables like this: port: element text portnoint primary key: element, portno index: element port_s: element text portnoint sname text pri int primary key: elem

Re: [SQL] Index usage on date feild , differences in '>' and '>='

2002-09-19 Thread Stephan Szabo
On Thu, 19 Sep 2002, Rajesh Kumar Mallah. wrote: > Thanks very much for the response. > set enable_seqscan=off; Definitely helps. > and for wide date ranges it usees indexes. > > > But with default value of enable_sequence changing date range seems to have effect. > can you explain me a bit mor

Re: [SQL] Index usage on date feild , differences in '>' and '>=' and between

2002-09-18 Thread Rajesh Kumar Mallah.
Thanks very much for the response. set enable_seqscan=off; Definitely helps. and for wide date ranges it usees indexes. But with default value of enable_sequence changing date range seems to have effect. can you explain me a bit more or point me to right documents for understanding the lan

Re: [SQL] Index usage on date feild , differences in '>' and '>='

2002-09-18 Thread Stephan Szabo
On Thu, 19 Sep 2002, Rajesh Kumar Mallah. wrote: > I am trying to improve a query to use existing indexes but facing diffculty. > > > Looks like 'between' amd '>=' are not using indexes althoug > and < does. > all my application code uses between and i am sure it use to work fine > at one point

[SQL] Index usage on date feild , differences in '>' and '>=' and between

2002-09-18 Thread Rajesh Kumar Mallah.
Hi , I am trying to improve a query to use existing indexes but facing diffculty. Looks like 'between' amd '>=' are not using indexes althoug > and < does. all my application code uses between and i am sure it use to work fine at one point of time. regds mallah. SQL TRANSCRIPT: ==

Re: [SQL] Index usage

2001-06-08 Thread Stephan Szabo
On Fri, 8 Jun 2001, Subra Radhakrishnan wrote: > Hi All, > > The index created by me is not being used while doing > select. I found that out by using the EXPLAIN. For > example: > > Table department has > > dept_num > dept_desc > > > Table 'employee' looks like this: >

[SQL] Index usage

2001-06-08 Thread Subra Radhakrishnan
Hi All, The index created by me is not being used while doing select. I found that out by using the EXPLAIN. For example: Table department has dept_num dept_desc Table 'employee' looks like this: emp_num primary key, emp_name, dept_num (this i