[erlang-questions] Question: Limiting size of result set in mnesia

Ahmed Ali ahmed.nawras@REDACTED
Mon Apr 28 15:51:15 CEST 2008


Hi Hynek,

Thanks for the clarification. However, I still don't understand what's
the point of  n_elements in qlc:info(Q,[{n_elements,N}]). In QLC
documentation, it names 2 kinds of options, "Option = EvalOption |
ReturnOption" which suggests that qlc:info/2 can be used to set
evaluation time options.

Also, I'm assuming I can remove {unique, true} option from
qlc:append/2 and the result is still the same.

Best regards,

Ahmed Al-Issaei

On Mon, Apr 28, 2008 at 5:26 PM, Hynek Vychodil
<vychodil.hynek@REDACTED> wrote:
> No, qlc:info just returns info. You should use cursor and next_answers.
>
> Just from documentation:
> C = qlc:cursor(qlc:q([X || X <- qlc:append(QH1, QH2)],{unique,true})),
> R = qlc:next_answers(C, 5),
> ok = qlc:delete_cursor(C),
>
> R.
>
>
>
> On Mon, Apr 28, 2008 at 2:42 PM, Ahmed Ali <ahmed.nawras@REDACTED> wrote:
> > Thanks Hynek and Kenneth for the quick response.
> >
> > Just to confirm, for qlc, I should write the query first and then run
> > qlc:info/2 on it in order to do the limiting, as the example below
> > shows. Is this it?
> >
> > e.g.:
> > Q = qlc:q(...),
> > qlc:info(Q, [{n_elements, 5}]
> >
> >
> > Best regards,
> >
> > Ahmed Al-Issaei
> >
> >
> >
> >
> > On Mon, Apr 28, 2008 at 4:32 PM, Kenneth Lundin
> > <kenneth.lundin@REDACTED> wrote:
> > > Hi,
> > >
> > >  You can use qlc
> > >  http://www.erlang.org/doc/man/qlc.html
> > >   or you can use
> > >  mnesia:select/4 in combination with mnesia:select/1
> > >  http://www.erlang.org/doc/man/mnesia.html#select-4
> > >
> > >  /Kenneth Erlang/OTP, Ericsson
> > >
> > >
> > >
> > >
> > >  On 4/28/08, Ahmed Ali <ahmed.nawras@REDACTED> wrote:
> > >  > Hi All,
> > >  >
> > >  > Does anyone have an idea of how to limit size of result set in mnesia
> > >  > similar to the effect of LIMIT clause in the SQL query below in
> MySQL?
> > >  >
> > >  > SELECT * FROM Topic LIMIT 5;
> > >  >
> > >  > Best regards,
> > >  >
> > >  > Ahmed Al-Issaei
> > >
> > >
> > > > _______________________________________________
> > >  > erlang-questions mailing list
> > >  > erlang-questions@REDACTED
> > >  > http://www.erlang.org/mailman/listinfo/erlang-questions
> > >  >
> > >
> > _______________________________________________
> > erlang-questions mailing list
> > erlang-questions@REDACTED
> > http://www.erlang.org/mailman/listinfo/erlang-questions
> >
>
>
>
> --
> --Hynek (Pichi) Vychodil



More information about the erlang-questions mailing list