SPOD ORDER BY/GROUP BY/WHERE/LIMIT

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

SPOD ORDER BY/GROUP BY/WHERE/LIMIT

Julien CASTETS
Hi all,

I'm currently working on a website that collect data from MySQL (target php).
I'm not sure the way to get sorted data  (GROUP BY/ORDER BY) either
filtered data (WHERE/LIMIT) with SPOD.

I'm sure I can sort or filter data using haxe but my question is, what
is the best way between, in term of performance:

* sort/filter using SQL?
* sort/filter the List<T> returned by returned by php.db.Manager.all?

What I mean by performance is server response timing, I think I should
not take server memory into consideration for this case, maybe I'm
wrong, you tell me :)

Do you think I need to extend php.db.Manager to add this or
sort/filter using haxe will be better?

Thanks
Cheers
Julien

PS:
I don't think I need some crazy performance with that, I'm just asking.
This seems to be not documented on http://haxe.org/doc/neko/spod

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: SPOD ORDER BY/GROUP BY/WHERE/LIMIT

gershon
WHERE\LIMIT will undoubtedly give you better speed than post processing of the results...

Working with MySql you should have no problems filtering, i've written some php stuff using a flat-file database (with sql syntax, http://fsql.sourceforge.net/)
which still has some bugs, especially with LIMIT, so post-filtering\ was a must...

At any rate,  the most noticeable bottleneck is still sending and rendering the data in html...

About php.db.Manager, when you said "extending" did you mean that in a sub-class way? either that or a class\function to sort\filter the returned List<T>...

Cheers, gershon.

On Wed, Apr 14, 2010 at 8:27 PM, Julien CASTETS <[hidden email]> wrote:
Hi all,

I'm currently working on a website that collect data from MySQL (target php).
I'm not sure the way to get sorted data  (GROUP BY/ORDER BY) either
filtered data (WHERE/LIMIT) with SPOD.

I'm sure I can sort or filter data using haxe but my question is, what
is the best way between, in term of performance:

* sort/filter using SQL?
* sort/filter the List<T> returned by returned by php.db.Manager.all?

What I mean by performance is server response timing, I think I should
not take server memory into consideration for this case, maybe I'm
wrong, you tell me :)

Do you think I need to extend php.db.Manager to add this or
sort/filter using haxe will be better?

Thanks
Cheers
Julien

PS:
I don't think I need some crazy performance with that, I'm just asking.
This seems to be not documented on http://haxe.org/doc/neko/spod

--
haXe - an open source web programming language
http://haxe.org


--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: SPOD ORDER BY/GROUP BY/WHERE/LIMIT

Julien CASTETS
Hi gershon,

My bad I found this: 'public function search( x : {}, ?lock : Bool ) : List<T>'

I meant sub-class it, that's what I think I'll do to add the
LIMIT/ORDER/GROUP behavior.

Thanks
Julien

2010/4/14 gershon <[hidden email]>:

> WHERE\LIMIT will undoubtedly give you better speed than post processing of
> the results...
>
> Working with MySql you should have no problems filtering, i've written some
> php stuff using a flat-file database (with sql syntax,
> http://fsql.sourceforge.net/)
> which still has some bugs, especially with LIMIT, so post-filtering\ was a
> must...
>
> At any rate,  the most noticeable bottleneck is still sending and rendering
> the data in html...
>
> About php.db.Manager, when you said "extending" did you mean that in a
> sub-class way? either that or a class\function to sort\filter the returned
> List<T>...
>
> Cheers, gershon.
>
> On Wed, Apr 14, 2010 at 8:27 PM, Julien CASTETS <[hidden email]>
> wrote:
>>
>> Hi all,
>>
>> I'm currently working on a website that collect data from MySQL (target
>> php).
>> I'm not sure the way to get sorted data  (GROUP BY/ORDER BY) either
>> filtered data (WHERE/LIMIT) with SPOD.
>>
>> I'm sure I can sort or filter data using haxe but my question is, what
>> is the best way between, in term of performance:
>>
>> * sort/filter using SQL?
>> * sort/filter the List<T> returned by returned by php.db.Manager.all?
>>
>> What I mean by performance is server response timing, I think I should
>> not take server memory into consideration for this case, maybe I'm
>> wrong, you tell me :)
>>
>> Do you think I need to extend php.db.Manager to add this or
>> sort/filter using haxe will be better?
>>
>> Thanks
>> Cheers
>> Julien
>>
>> PS:
>> I don't think I need some crazy performance with that, I'm just asking.
>> This seems to be not documented on http://haxe.org/doc/neko/spod
>>
>> --
>> haXe - an open source web programming language
>> http://haxe.org
>
>
> --
> haXe - an open source web programming language
> http://haxe.org
>

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: SPOD ORDER BY/GROUP BY/WHERE/LIMIT

Jason O'Neil
Hi Julien

That sounds like it could be good, any chance you'd be up for emailing a copy so I can see how you do it?  :P

Jason

On Thu, Apr 15, 2010 at 2:34 AM, Julien CASTETS <[hidden email]> wrote:
Hi gershon,

My bad I found this: 'public function search( x : {}, ?lock : Bool ) : List<T>'

I meant sub-class it, that's what I think I'll do to add the
LIMIT/ORDER/GROUP behavior.

Thanks
Julien

2010/4/14 gershon <[hidden email]>:
> WHERE\LIMIT will undoubtedly give you better speed than post processing of
> the results...
>
> Working with MySql you should have no problems filtering, i've written some
> php stuff using a flat-file database (with sql syntax,
> http://fsql.sourceforge.net/)
> which still has some bugs, especially with LIMIT, so post-filtering\ was a
> must...
>
> At any rate,  the most noticeable bottleneck is still sending and rendering
> the data in html...
>
> About php.db.Manager, when you said "extending" did you mean that in a
> sub-class way? either that or a class\function to sort\filter the returned
> List<T>...
>
> Cheers, gershon.
>
> On Wed, Apr 14, 2010 at 8:27 PM, Julien CASTETS <[hidden email]>
> wrote:
>>
>> Hi all,
>>
>> I'm currently working on a website that collect data from MySQL (target
>> php).
>> I'm not sure the way to get sorted data  (GROUP BY/ORDER BY) either
>> filtered data (WHERE/LIMIT) with SPOD.
>>
>> I'm sure I can sort or filter data using haxe but my question is, what
>> is the best way between, in term of performance:
>>
>> * sort/filter using SQL?
>> * sort/filter the List<T> returned by returned by php.db.Manager.all?
>>
>> What I mean by performance is server response timing, I think I should
>> not take server memory into consideration for this case, maybe I'm
>> wrong, you tell me :)
>>
>> Do you think I need to extend php.db.Manager to add this or
>> sort/filter using haxe will be better?
>>
>> Thanks
>> Cheers
>> Julien
>>
>> PS:
>> I don't think I need some crazy performance with that, I'm just asking.
>> This seems to be not documented on http://haxe.org/doc/neko/spod
>>
>> --
>> haXe - an open source web programming language
>> http://haxe.org
>
>
> --
> haXe - an open source web programming language
> http://haxe.org
>

--
haXe - an open source web programming language
http://haxe.org


--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: SPOD ORDER BY/GROUP BY/WHERE/LIMIT

Julien CASTETS
Hi,

Here is a copy of what I did (quite simple in fact)
.
By overriding the function php.db.Manager.objects( sql : String, lock
: Bool ) : List<T> this should work for Manager::all and
Manager::search.
It seems to work well for me, tell me if it don't.

Anyway I don't understand why I can't override php.db.Manager by

class ManagerEx extends php.db.Manager<php.db.Object> //this does not compile

either

class ManagerEx<T : php.db.Object> extends
php.db.Manager<php.db.Object> //this is compiling but all
php.db.Object subclasses need to be cast.

So I use Dynamic like this to avoid writing cast in whole user code

class ManagerEx<T : php.db.Object> extends php.db.Manager<Dynamic>

I'm sure you have an idea :)

2010/4/15 Jason O'Neil <[hidden email]>:

> Hi Julien
>
> That sounds like it could be good, any chance you'd be up for emailing a
> copy so I can see how you do it?  :P
>
> Jason
>
> On Thu, Apr 15, 2010 at 2:34 AM, Julien CASTETS <[hidden email]>
> wrote:
>>
>> Hi gershon,
>>
>> My bad I found this: 'public function search( x : {}, ?lock : Bool ) :
>> List<T>'
>>
>> I meant sub-class it, that's what I think I'll do to add the
>> LIMIT/ORDER/GROUP behavior.
>>
>> Thanks
>> Julien
>>
>> 2010/4/14 gershon <[hidden email]>:
>> > WHERE\LIMIT will undoubtedly give you better speed than post processing
>> > of
>> > the results...
>> >
>> > Working with MySql you should have no problems filtering, i've written
>> > some
>> > php stuff using a flat-file database (with sql syntax,
>> > http://fsql.sourceforge.net/)
>> > which still has some bugs, especially with LIMIT, so post-filtering\ was
>> > a
>> > must...
>> >
>> > At any rate,  the most noticeable bottleneck is still sending and
>> > rendering
>> > the data in html...
>> >
>> > About php.db.Manager, when you said "extending" did you mean that in a
>> > sub-class way? either that or a class\function to sort\filter the
>> > returned
>> > List<T>...
>> >
>> > Cheers, gershon.
>> >
>> > On Wed, Apr 14, 2010 at 8:27 PM, Julien CASTETS
>> > <[hidden email]>
>> > wrote:
>> >>
>> >> Hi all,
>> >>
>> >> I'm currently working on a website that collect data from MySQL (target
>> >> php).
>> >> I'm not sure the way to get sorted data  (GROUP BY/ORDER BY) either
>> >> filtered data (WHERE/LIMIT) with SPOD.
>> >>
>> >> I'm sure I can sort or filter data using haxe but my question is, what
>> >> is the best way between, in term of performance:
>> >>
>> >> * sort/filter using SQL?
>> >> * sort/filter the List<T> returned by returned by php.db.Manager.all?
>> >>
>> >> What I mean by performance is server response timing, I think I should
>> >> not take server memory into consideration for this case, maybe I'm
>> >> wrong, you tell me :)
>> >>
>> >> Do you think I need to extend php.db.Manager to add this or
>> >> sort/filter using haxe will be better?
>> >>
>> >> Thanks
>> >> Cheers
>> >> Julien
>> >>
>> >> PS:
>> >> I don't think I need some crazy performance with that, I'm just asking.
>> >> This seems to be not documented on http://haxe.org/doc/neko/spod
>> >>
>> >> --
>> >> haXe - an open source web programming language
>> >> http://haxe.org
>> >
>> >
>> > --
>> > haXe - an open source web programming language
>> > http://haxe.org
>> >
>>
>> --
>> haXe - an open source web programming language
>> http://haxe.org
>
>
> --
> haXe - an open source web programming language
> http://haxe.org
>

--
haXe - an open source web programming language
http://haxe.org

ManagerEx.hx (2K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: SPOD ORDER BY/GROUP BY/WHERE/LIMIT

Jason O'Neil
Thanks for that Julien

I've got an upcoming project that it could be useful in... Thanks again

Jason

On Sun, Apr 18, 2010 at 4:25 AM, Julien CASTETS <[hidden email]> wrote:
Hi,

Here is a copy of what I did (quite simple in fact)
.
By overriding the function php.db.Manager.objects( sql : String, lock
: Bool ) : List<T> this should work for Manager::all and
Manager::search.
It seems to work well for me, tell me if it don't.

Anyway I don't understand why I can't override php.db.Manager by

class ManagerEx extends php.db.Manager<php.db.Object> //this does not compile

either

class ManagerEx<T : php.db.Object> extends
php.db.Manager<php.db.Object> //this is compiling but all
php.db.Object subclasses need to be cast.

So I use Dynamic like this to avoid writing cast in whole user code

class ManagerEx<T : php.db.Object> extends php.db.Manager<Dynamic>

I'm sure you have an idea :)

2010/4/15 Jason O'Neil <[hidden email]>:
> Hi Julien
>
> That sounds like it could be good, any chance you'd be up for emailing a
> copy so I can see how you do it?  :P
>
> Jason
>
> On Thu, Apr 15, 2010 at 2:34 AM, Julien CASTETS <[hidden email]>
> wrote:
>>
>> Hi gershon,
>>
>> My bad I found this: 'public function search( x : {}, ?lock : Bool ) :
>> List<T>'
>>
>> I meant sub-class it, that's what I think I'll do to add the
>> LIMIT/ORDER/GROUP behavior.
>>
>> Thanks
>> Julien
>>
>> 2010/4/14 gershon <[hidden email]>:
>> > WHERE\LIMIT will undoubtedly give you better speed than post processing
>> > of
>> > the results...
>> >
>> > Working with MySql you should have no problems filtering, i've written
>> > some
>> > php stuff using a flat-file database (with sql syntax,
>> > http://fsql.sourceforge.net/)
>> > which still has some bugs, especially with LIMIT, so post-filtering\ was
>> > a
>> > must...
>> >
>> > At any rate,  the most noticeable bottleneck is still sending and
>> > rendering
>> > the data in html...
>> >
>> > About php.db.Manager, when you said "extending" did you mean that in a
>> > sub-class way? either that or a class\function to sort\filter the
>> > returned
>> > List<T>...
>> >
>> > Cheers, gershon.
>> >
>> > On Wed, Apr 14, 2010 at 8:27 PM, Julien CASTETS
>> > <[hidden email]>
>> > wrote:
>> >>
>> >> Hi all,
>> >>
>> >> I'm currently working on a website that collect data from MySQL (target
>> >> php).
>> >> I'm not sure the way to get sorted data  (GROUP BY/ORDER BY) either
>> >> filtered data (WHERE/LIMIT) with SPOD.
>> >>
>> >> I'm sure I can sort or filter data using haxe but my question is, what
>> >> is the best way between, in term of performance:
>> >>
>> >> * sort/filter using SQL?
>> >> * sort/filter the List<T> returned by returned by php.db.Manager.all?
>> >>
>> >> What I mean by performance is server response timing, I think I should
>> >> not take server memory into consideration for this case, maybe I'm
>> >> wrong, you tell me :)
>> >>
>> >> Do you think I need to extend php.db.Manager to add this or
>> >> sort/filter using haxe will be better?
>> >>
>> >> Thanks
>> >> Cheers
>> >> Julien
>> >>
>> >> PS:
>> >> I don't think I need some crazy performance with that, I'm just asking.
>> >> This seems to be not documented on http://haxe.org/doc/neko/spod
>> >>
>> >> --
>> >> haXe - an open source web programming language
>> >> http://haxe.org
>> >
>> >
>> > --
>> > haXe - an open source web programming language
>> > http://haxe.org
>> >
>>
>> --
>> haXe - an open source web programming language
>> http://haxe.org
>
>
> --
> haXe - an open source web programming language
> http://haxe.org
>

--
haXe - an open source web programming language
http://haxe.org


--
haXe - an open source web programming language
http://haxe.org