Search Postgresql Archives

planning issue

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



if you have time, could you offer advice on this:

i'm doing a database cleanup right now -- 1.4M records -- and each query is taking 1 second

i can't really wait 2 weeks for this to finish , so I'm hoping that someone will be able to help out

the issue is that the planner keeps doing a sequential scan, despite the fact that the requesite columns are indexed.

hoping someone may be able to offer advice:.

SELECT
	*
FROM
	table_a
WHERE
	id != 10001
	AND
	(
			(  field_1 ilike '123' )
			OR
			( field_2 ilike 'abc' )
	)


QUERY PLAN ------------------------------------------------------------------------ ------------------------------------------------------------------------ -------------------------
Seq Scan on table_a  (cost=0.00..22779.68 rows=1 width=346)
Filter: ((id <> 10001) AND (((field_1)::text ~~* '123'::text) OR ((field_2)::text ~~* 'abc'::text)))


however, i have the following indexes:

    "table_a__pkey" PRIMARY KEY, btree (id)
    "table_a__idx__field_1" btree (field_1)
    "table_a__idx__field_2" btree (field_2)

can anyone offer advice to help me use the indexes on this ?


// Jonathan Vanasco


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux