Re: Poor man's partitioned index .... not being used?

2019-03-20 Thread Andrew Gierth
> "Gunther" == Gunther writes: Gunther> foo=# CREATE UNIQUE INDEX Test_pk0 ON Test(id) WHERE mod(id,2) = 0; Gunther> CREATE INDEX Gunther> foo=# EXPLAIN SELECT * FROM Test WHERE id = '8934'; Gunther> QUERY PLAN Gunther>

Re: Poor man's partitioned index .... not being used?

2019-03-20 Thread David Rowley
On Thu, 21 Mar 2019 at 15:51, Gunther wrote: > foo=# CREATE UNIQUE INDEX Test_pk0 ON Test(id) WHERE mod(id,2) = 0; > CREATE INDEX > foo=# CREATE UNIQUE INDEX Test_pk1 ON Test(id) WHERE mod(id,2) = 1; > CREATE INDEX > foo=# ANALYZE Test; > ANALYZE > foo=# EXPLAIN SELECT * FROM Test WHERE id = '8934

Poor man's partitioned index .... not being used?

2019-03-20 Thread Gunther
Hi all, look at this short story please: foo=# CREATE TABLE Test(id int NOT NULL PRIMARY KEY); CREATE TABLE foo=# INSERT INTO test SELECT row_number() OVER() FROM pg_class a CROSS JOIN pg_class b; INSERT 0 388129 foo=# EXPLAIN SELECT * FROM Test WHERE id = '8934';

AW: Performance issue with order by clause on

2019-03-20 Thread Stephan Schmidt
Have you tried creating an sorted index like CREATE INDEX table_modificationtime_idx ON “TABLE“ USING btree(modificationtime DESC) WHERE (enabled=1)? Best Regards Stephan Von: Corey Huinker Gesendet: Mittwoch, 20. März 2019 18:34 An: Maracska Ádám