2015-12-12 19:00 GMT+01:00 Simon Slavin <slavins at bigfraud.org>:

>
> On 12 Dec 2015, at 2:42pm, Cecil Westerhof <cldwesterhof at gmail.com> wrote:
>
> >> SELECT
> >>        (SELECT COUNT(*) FROM proverbs)  AS Total
> >>    ,   (SELECT COUNT(*) FROM proverbs WHERE used IS NOT NULL) AS Used
> >>    ,   (SELECT COUNT(*) FROM proverbs WHERE used IS NULL)     AS Free
> >>
> >
> > ?That is what I am using now, but it is inefficient. This uses three
> scans
> > instead of two.?
>
> Do you have an index on the column 'used' ?


?Not at the moment. But maybe that is a good idea.?

-- 
Cecil Westerhof

Reply via email to