Re: [GENERAL] Improving speed of query

2016-09-26 Thread Nicolas Paris
Hi, You could run 2 queries separatly and asynchrouneously 1) the limit 10 2) the count While the limit 10 query would be showned instanteneously, the web table would way for the count to build the pagination Le lun. 26 sept. 2016 à 20:59, Leonardo M. Ramé a écrit : > Hi, I'm using a query t

[GENERAL] Improving speed of query

2016-09-26 Thread Leonardo M . Ramé
Hi, I'm using a query to fill a paginated table. The task involves filtering, sorting, limit, offset and count of all rows (to determine the number of pages). My current query is this: select count(*) over() as totalrows, case when (d.filepath is not null) then '1' else '0' end as HasDocumen

Re: [GENERAL] improving speed of query that uses a multi-column "filter" ?

2014-10-01 Thread Jonathan Vanasco
On Oct 1, 2014, at 12:34 AM, Misa Simic wrote: > Have you considered maybe partial indexes? > > http://www.postgresql.org/docs/9.3/static/indexes-partial.html > > I.e idx1 on pk column of the table with where inside index exactly the same > as your first where > > Idx2 on pk column with where

Re: [GENERAL] improving speed of query that uses a multi-column "filter" ?

2014-09-30 Thread Misa Simic
On Wednesday, October 1, 2014, Jonathan Vanasco wrote: > > I'm trying to improve the speed of suite of queries that go across a few > million rows. > > They use 2 main "filters" across a variety of columns: > > WHERE (col_1 IS NULL ) AND (col_2 IS NULL) AND ((col_3 IS NULL) OR > (col_3 =

Re: [GENERAL] improving speed of query that uses a multi-column "filter" ?

2014-09-30 Thread Jonathan Vanasco
On Sep 30, 2014, at 8:04 PM, John R Pierce wrote: > if col_1 IS NULL, then that OR condition doesn't make much sense. just > saying... I was just making a quick example. There are two commonly used "filter sets", each are mostly on Bool columns that allow null -- but one checks to see if

Re: [GENERAL] improving speed of query that uses a multi-column "filter" ?

2014-09-30 Thread John R Pierce
On 9/30/2014 4:50 PM, Jonathan Vanasco wrote: WHERE (col_1 IS NULL ) AND (col_2 IS NULL) AND ((col_3 IS NULL) OR (col_3 = col_1)) if col_1 IS NULL, then that OR condition doesn't make much sense. just saying... these 4 columns are all nullable booleans, so they can be TRUE, FA

[GENERAL] improving speed of query that uses a multi-column "filter" ?

2014-09-30 Thread Jonathan Vanasco
I'm trying to improve the speed of suite of queries that go across a few million rows. They use 2 main "filters" across a variety of columns: WHERE (col_1 IS NULL ) AND (col_2 IS NULL) AND ((col_3 IS NULL) OR (col_3 = col_1)) WHERE (col_1 IS True ) AND (col_2 IS True) AND (col_