Re: Reversing NULLS in ORDER causes index not to be used?

2020-12-18 Thread Ken Tanzer
On Fri, Dec 18, 2020 at 6:03 PM Tom Lane wrote: > Ken Tanzer writes: > > Hi. I'm wondering if this is normal or at least known behavior? > > Basically, if I'm specifying a LIMIT and also NULLS FIRST (or NULLS LAST > > with a descending sort), I get a sequence

Reversing NULLS in ORDER causes index not to be used?

2020-12-18 Thread Ken Tanzer
Hi. I'm wondering if this is normal or at least known behavior? Basically, if I'm specifying a LIMIT and also NULLS FIRST (or NULLS LAST with a descending sort), I get a sequence scan and a couple of orders of magnitude slower query. Perhaps not relevantly, but definitely ironically, the sort fi

Re: Query takes way longer with LIMIT, and EXPLAIN takes way longer than actual query

2020-08-14 Thread Ken Tanzer
On Fri, Aug 14, 2020 at 3:04 PM Justin Pryzby wrote: > Due to the over-estimated rowcount, the planner believes that (more) rows > will > be output (sooner) than they actually are: > >-> Nested Loop Semi Join (cost=47.11..31367302.81 ROWS=611586 > width=336) (actual time=47.098..97236.123 R

Query takes way longer with LIMIT, and EXPLAIN takes way longer than actual query

2020-08-14 Thread Ken Tanzer
Hi. I've got a query that runs fine (~50ms). When I add a "LIMIT 25" to it though, it takes way longer. The query itself then takes about 4.5 seconds. And when I do an explain, it takes 90+ seconds for the same query! Explains and detailed table/view info below. tbl_log has 1.2M records, tbl_

Re: Speeding up query pulling comments from pg_catalog

2019-07-22 Thread Ken Tanzer
On Sat, Jul 20, 2019 at 12:25 PM Tom Lane wrote: > Ken Tanzer writes: > > On Sat, Jul 20, 2019 at 7:46 AM Tom Lane wrote: > >> and then to add insult to injury, has to search pg_description a second > >> time for each hit. > > > Not sure if I'm underst

Re: Speeding up query pulling comments from pg_catalog

2019-07-20 Thread Ken Tanzer
On Sat, Jul 20, 2019 at 7:46 AM Tom Lane wrote: > But if you do so manually you'll end up with something like > > SELECT c.relname AS table, a.attname AS column, d.description AS comment > FROM > pg_catalog.pg_attribute a JOIN pg_catalog.pg_class c ON a.attrelid = > c.oid > LEFT JOIN pg_catal

Speeding up query pulling comments from pg_catalog

2019-07-19 Thread Ken Tanzer
Hi. I've got an app that queries pg_catalog to find any table columns that have comments. After setting up PgBadger, it was #2 on my list of time consuming queries, with min/max/avg duration of 199/2351/385 ms (across ~12,000 executions logged). I'm wondering if there are any ways to speed this

Re: postgresql unix socket connections

2019-01-10 Thread Ken Tanzer
On Wed, Jan 9, 2019 at 7:09 AM Mariel Cherkassky < mariel.cherkas...@gmail.com> wrote: > Hey Tom, > I'm aware of how I can solve it. I wanted to understand why after > installing the pg 9.6 packages suddenly psql tries to access the socket on > /var/run/postgresql. Does the libpq default unix sock